Skip to content
Quiz · Functions as values · lesson 4 of 10

Quiz — sorted with key

What does the program print?

Python
people = [("ann", 31), ("bob", 25), ("cid", 31)]
by_age = sorted(people, key=lambda p: p[1])
print([name for name, age in by_age])

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way