How to Sort List Descending in Python?

By Hardik Savani October 30, 2023 Category : Python

Hello Artisan,

This article will provide some of the most important example python sort list descending order. you will learn python program to sort list in descending order. Here you will learn sort descending python list. This article will give you a simple example of how to sort list descending in python. Here, Create a basic example of sort list in descending order python.

There are several ways to reverse order python list. i will give you simple one example to descending sort with python list. we will use sort() function to sort list descending order to python list.

Example 1:

main.py

myList = ["Hardik", "Vimal", "Ankit", "Mahesh"]
  
# python list reverse order
myList.sort(reverse=True)
  
print(myList)

Output:

['Vimal', 'Mahesh', 'Hardik', 'Ankit']

I hope it can help you...

Tags :
Shares