The sort() method in Python sorts the elements of a given  list  in a specific order: Ascending or Descending.

Python List Sort Example

Python list sort() is an inbuilt function that sorts the list ascending by default. The sort() method sorts the elements of a given list in the specific order, either Ascending or Descending. You can also make the function to decide the sorting criteria. The sort() method doesn’t return any value. Instead, it changes the original list.

Syntax

The syntax of the sort() method is the following.

list.sort(reverse=True|False, key=myFunc)

#python #python list sort

Python List sort: How to Sort List in Python
6.55 GEEK