Python Sort Exercises

Let’s check out some exercises that will help understand Python’s .sort() method better.

Exercise 11-a

Sort the list in ascending order with .sort() method.


.sort() method will modify the actual list and sort it.

lst.sort()

Exercise 11-b

This time sort the countries in alphabetic order.


.sort() method will modify the actual list and sort it.

lst.sort(reverse = False)