Python: Sort List in Descending Order

In order to sort a list of elements in descending order, we can make use of the sort() method by passing the option reverse=True

Example:
list_of_numbers = [22, 45, 245, 64, 345, 66, 33, 68, 24, 27, 78]

list_of_numbers.sort(reverse=True)

print(list_of_numbers)
Output:
[345, 245, 78, 68, 66, 64, 45, 33, 27, 24, 22]
Python- Sort List in Descending Order
Read Documentaion:

List Objects - List.sort(): https://docs.python.org/3/library/stdtypes.html#list.sort

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!