Sorting Python list defined order

Below example uses the .sort() list method in Python. First, the method is applied to sort list values in ascending order. Next, it is used to sort in descending order.

ls = [1,4,5,3,7,2,11,10,0]
ls.sort(reverse=True)

print(ls)

ls.sort() # reverse = False by default

print(ls)

This prints the following output:

[11, 10, 7, 5, 4, 3, 2, 1, 0]
[0, 1, 2, 3, 4, 5, 7, 10, 11]