The sort() method in Python sorts the elements of a given list in a specific order: Ascending or Descending.
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.
The syntax of the sort() method is the following.
list.sort(reverse=True|False, key=myFunc)
#python #python list sort