Skip to content

All topics  /  Python

Sort List Descending in Python Tutorial Example

Python ·

Hi Dev,

Now, let's see the post of sort list descending in the Python tutorial example. Here you will learn Python sort lists in descending order. We will look at an example of a Python program to sort lists in descending order. In this article, we will implement a sort descending Python list. you will do the following things for how to sort lists descending in Python.

There are several ways to reverse order Python lists. I will give you a simple one example of descending sort with a Python list. we will use the sort() function to sort the list in descending order to the Python list.

Example :


main.py

myList = ["Hiren", "Virat", "Anushka", "Murli"]

  
# python list reverse order
myList.sort(reverse=True)

  
print(myList)

Output:

['Virat', 'Murli', 'Hiren', 'Anushka']