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.
Exercise 11-b
This time sort the countries in alphabetic order.
Exercise 11-c
Now sort the list in descending order with .sort() method.
Exercise 11-d
Can you sort the gift list in reverse alphabetic order?
Exercise 11-e
Sort the list below in reverse alphabetic order and then assign the last element to the answer_1 variable.
Exercise 11-f
Sort the cities from z to a.
Exercise 11-g
Sort the keys of the dictionary from a to z.
Hint: You might want to create a list of the keys first with the help of a dictionary method.