Lesson 1: Dictionaries — keys & values
A list orders values by position, but sometimes you want to look something up by name rather than by number. A dictionary (dict) stores key-value pairs, so you can fetch a value by its key — fast and readable.
A dictionary is like a cabinet of labeled drawers. You say the drawer's name (the key) and get whatever is inside it (the value).
- dictionary
- A data structure that stores key-value pairs.
- key
- The unique name that points to a value in a dictionary.
- value
- The information stored under a given key.