Lesson 4: Nested data
Real data is almost always nested: a list of dictionaries (e.g. a list of users), or a dictionary whose values are lists (e.g. categories with items). You access it layer by layer: first pick an item, then reach inside it.
Like a crate of boxes, each box holding notes. To reach a note, you first open the right box, then read the note.
- nested structure
- A data structure that contains another structure inside it, like a dict inside a list.
- list of dicts
- A list where each element is a dictionary — common for representing records.
- chained access
- Reaching in layer by layer, e.g. data[0]["name"].