Today we’ll introduce a new compound data type called the dictionary.
Don’t get me wrong; lists are great. They allow us to take lots of simple data types and squish them all into the same variable. But what’s with this whole accessing data by a number thing? Do you as a human lookup stuff in your brain via number?
Internal Monologue
What’s my favorite color?
Oh I store that at index 137875.
It’s "green"
End Internal Monologue
Probably not. More likely you store it with a phrase, like “favorite_color” (in CS we call this a key) and get back your favorite color "green"
(which we call a value). Dictionaries are Python’s way of emulating this sort of storage and that’s what we’ll be talking about today!
Today's Resources
1. Exercise Files
Download Exercise Files2. Slides
3. Pre-Recorded Lecture Video(s), Mini-Quizzes, and Live Recordings
Link | Title | Type | Duration |
---|---|---|---|
Video 1 | Live Lecture Recording | lecture | 50:00 |