Key Ideas
1What is a Dictionary?. A dictionary stores data as key-value pairs. Instead of accessing items by numeric index like a list, you access them by a meaningful key — a label you define. This ma...
2Iterating Dictionaries. Three views let you loop over different aspects of a dictionary. Each returns a special view object that always reflects the current state of the dict.
3Nested Dicts & Real Patterns. Dictionaries are the building block of almost all Python data — JSON APIs, database records, configuration files, and objects are all represented as nested dicts in pr...
4Sets — Unique Unordered Collections. A set is an unordered collection of unique items. Duplicate values are automatically discarded. Sets are incredibly fast for membership testing and are the go-to tool ...
5Choosing the Right Collection. Python's four main collection types each have a distinct purpose. Picking the right one for your data makes code cleaner, faster, and less error-prone.