Friday - Lecture 20 - Dictionaries
Date: February 27
Date: February 27
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!
In-Class Resources
| Link | Title | Type | Duration |
|---|---|---|---|
| Video 1 | Live Lecture Recording | lecture | 50:00 |