Lesson 22 of 34 · Dictionaries & Sets
Quiz: Python Dictionaries and Sets
Dictionaries and sets are built on the same idea — hashing — which is what makes looking up a key or checking membership so fast. In this chapter you learned how to read and update dictionaries safely with get(), setdefault() and pop(), how to loop over keys, values and items, how sets remove duplicates and combine with |, &, - and ^, and how comprehensions build both in one line.
Answer these six questions, then go and face the chapter boss.
What this quiz covers
The questions check what you learned in the Dictionaries & Sets chapter of Learn Python. Not sure about a topic? Review its lesson first:
- Python Dictionaries: Keys, Values and Methods
Learn Python dictionaries: create, read and update key-value pairs, use get(), items() and setdefault(), loop over dicts and count things.
- Python Sets and Set Operations
Use Python sets to remove duplicates, test membership fast and combine data with union, intersection and difference. Interactive exercises.
- Python Dictionary and Set Comprehensions
Build Python dictionaries and sets in one line with dict and set comprehensions: transform, filter and invert data the Pythonic way.
Keep learning
Need a quick reminder? The Python cheat sheet has every topic of Learn Python on one page.
Lesson last updated on .