Chapters
Python114 chapters

Exercises

Sort Lists

3 tasks. Write the code, press Check, and the page runs it against a real Python interpreter.

Exercise 1

Sort the names ignoring case.

Python
names = ["banana", "Apple", "cherry"]
# print them sorted case-insensitively
Exercise 2

Sort the people by age, youngest first.

Python
people = [("Ada", 36), ("Grace", 45), ("Katherine", 28)]
# print them sorted by age
Exercise 3

This sets numbers to None. Fix it so it prints the sorted list.

Python
numbers = [3, 1, 2]
numbers = numbers.sort()
print(numbers)