February 2024
Beginner
352 pages
8h 16m
English
In this exercise, we’ll use the same data from the previous exercise on lists and use it to learn about Dictionaries or dicts.
You use key=value data all the time without realizing it. When you read an email, you might have:
1 From: j.smith@example.com
2 To: zed.shaw@example.com
3 Subject: I HAVE AN AMAZING INVESTMENT FOR YOU!!!
On the left are the keys (From, To, Subject), which are mapped to the contents on the right of the :. Programmers say the key is “mapped” to the value, but they could also say “set to” as in, “I set From to j.smith@example.com.” In Python, I might write this same email using a data object like this:
Read now
Unlock full access