-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex39.1.py
44 lines (36 loc) · 1017 Bytes
/
ex39.1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Study drill - stuff I can do with dictionaries
regional_food = {
"Oaxaca": "mole",
"Veracruz": "mole",
"Queretaro": "sopes",
"Chiapas": "quesadilla",
"DF": "kekas",
"Baja": "pescado"
}
regional_drinks = {
"Oaxaca": "mezcal",
"Veracruz": "cerveza",
"Queretaro": "vino tinto",
"Chiapas": "pox",
"DF": "tequilla",
"Baja": "vino blanco"
}
print(regional_food)
print(regional_drinks)
print(regional_food["Oaxaca"])
print(regional_food["DF"])
print(regional_drinks["DF"])
# Print dictionary keys, values, key-value pairs
print(regional_drinks.keys())
print(regional_drinks.values())
print(regional_drinks.items())
# Loop through dictionary
print('-' * 10)
for place, drink in list(regional_drinks.items()):
print(f"La gente drink {drink} in {place} todos los días.")
print(f"{place} is running out of {drink}.")
print('-' * 10)
# Add another key-value pair to dictionary
print('-' * 10)
regional_food.update({"Guanajuato": "gorditas"})
print(regional_food)