-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhw8.py
More file actions
41 lines (37 loc) · 1.1 KB
/
Copy pathhw8.py
File metadata and controls
41 lines (37 loc) · 1.1 KB
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
'''Create a dictionary to store information about 5 cities in Karnataka and their famous dishes.
Add a new city and its dish to the dictionary.
Update the dish for Bengaluru.
Remove one city from the dictionary.
Use the keys() method to print all city names in the dictionary.
Use the values() method to print all dishes
'''
d={
"bengaluru": "biryani",
"mandya":"sugar cane",
"mysuru": "mysur pak",
"manglore": "fish",
"goa": "enne"
}
d["tirupathi"]="ladoo" #adding mew item to d
print(d)
d["bengaluru"]="bennedose" #updating bengaluru
print(d)
del d["goa"] #delete
d.pop("goa")#removinge one city
print(d)
print(d.keys()) #printing all keys of d
print(d.values()) #printing all values of d
'''Create a dictionary to store details of two of your friends, including their names, favorite subject, and favorite food.
Access and print the favorite food of one friend.
'''
friends={
"name": "deekshitha",
"fav sub": "maths",
"fav food": "nonvej"
}
friends2={
"name": "aishu",
"fav sub": "accounts",
"fav food": "vej"
}
print(f"aishu's fav food is :{friends2["fav food"]}")