-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0058_fruit.py
More file actions
33 lines (28 loc) · 835 Bytes
/
0058_fruit.py
File metadata and controls
33 lines (28 loc) · 835 Bytes
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
fruit = {
"orange": "a sweet, orange, citrus fruit",
"apple": "good for making cider",
"lemon": "a sour, yellow citrus fruit",
"grape": "a small, sweet fruit growing in bunches",
"lime": "a sour, green citrus fruit",
}
print(fruit)
veg = {
"cabbage": "every child's favourite",
"sprouts": "mmmm, lovely",
"splinach": "can I have some more fruit, please"
}
print(veg)
veg.update(fruit) # includes all the items of fruit to veg dictionary. modifies the veg dictionary
print(veg)
print()
print()
print(fruit.update(veg)) # does not return anything. includes all the items of veg to fruit dictionary. modifies the fruit dictionary
print(fruit)
nice_and_nasty = fruit.copy()
nice_and_nasty.update(veg)
print("Nice and Nasty")
print(nice_and_nasty)
print("Veg")
print(veg)
print("Fruit")
print(fruit)