Stage 2 · 30 min · Pro
Dictionaries (dict) and sets
Store data by key with dict, count frequencies, loop with items(), get(); remove duplicates with set.
Objectives
- Create, read and update a dict
- Use get() to avoid KeyError
- Count frequencies with a dict
- Use set to remove duplicates
This lesson is for Pro members
Phone books, score sheets by name, counting how often words appear: "key → value" data is everywhere. dict is the most used data structure in real-world Python.
See Pro plans Open in the app