Sorting a Python Dictionary: Values, Keys, and More Quiz
Interactive Quiz ⋅ 10 Questions
By Joseph Peart
In this quiz, you’ll test your understanding of Sorting a Python Dictionary: Values, Keys, and More.
By working through this quiz, you’ll revisit using sorted() with lambdas and itemgetter() to sort dictionaries by keys, by values, or by nested attributes. You’ll also weigh the trade-offs of choosing a sorted key-value data structure.
The quiz contains 10 questions and there is no time limit. You’ll get 1 point for each correct answer. At the end of the quiz, you’ll receive a total score. The maximum score is 100%. Good luck!
Related Resources
Course
Sorting Dictionaries in Python: Keys, Values, and More
In this video course, you'll learn how to sort Python dictionaries. By the end, you'll be able to sort by key, value, or even nested attributes. But you won't stop there---you'll also measure the performance of variations when sorting and compare different key-value data structures.
Tutorial
Sorting a Python Dictionary: Values, Keys, and More
Learn how to sort a Python dictionary by value or key, handle nested attributes, and compare techniques to keep your code fast and readable.