Python List Sorting | How To Sort List In Python | FREE Python Lessons

Опубликовано: 24 Март 2021
на канале: NetworkShip
94
3

Python List are one of the most important data types used in python. Sometimes, we sort the items inside a list. This sorting is ascending by default. We can also do this sorting as descending by using reverse parameter as True.Because by default, this parameter is set to False.

Below, you can find two examples on Python List Sorting:


The first example is for ascending sorting:

list1 = [123, 28, 53, 5, 17, 80, 72]
list1.sort()
print(list1)

The output of this python code is like below:

[5, 17, 28, 53, 72, 80, 123]


The second example is for descending sorting:

list1 = [123, 28, 53, 5, 17, 80, 72]
list1.sort(reverse=True)
print(list1)

The output of this python code will be:

[123, 80, 72, 53, 28, 17, 5]

.
Python Course: https://ipcisco.com/course/python-pro...
Python List Sort : https://ipcisco.com/lesson/python-lis...
.
#pythonlists #pythonlistsort #pythonsorting #python #python3 #pythonprogramming #freepythoncourse


На этой странице сайта вы можете посмотреть видео онлайн Python List Sorting | How To Sort List In Python | FREE Python Lessons длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь NetworkShip 24 Март 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 94 раз и оно понравилось 3 зрителям. Приятного просмотра!