-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10.py
More file actions
22 lines (22 loc) · 938 Bytes
/
Copy path10.py
File metadata and controls
22 lines (22 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Dictionary is nothing but key value pair
d1 = {"Mohit"}
# print(type(d1))
d2 = {"Anoop":"burger", "Skillf":"Roti", "Rohan":"Fish", "Subham":{"B":"maggie", "L":"Roti", "D": "Chicken"}}
# print(d2["Subham"]["B"])
# print(d2["Anoop"])
# d2["Ankit"] = "JunK Food" #use for adding key value pair in dicitionary but br can use other methode
# d2[420] = "Kababs"
# del d2[420] #use to delete the pair
# print(d2)
# d3 = d2.copy() # it can copy d2 element to d3
# del d3["Anoop"]
# print(d2.copy())
# print(d3)
# print(d2.get("Anoop")) # it can give value of a perticular key
# d2.update({"Leena":"Toffe"}) # it can update the list
# print(d2)
# print(d2.keys()) # it can print the keys
# print(d2.items()) #it can print the items in the list
# print(d2.values()) # it can print the values in the list
# print(dict.fromkeys(d2,d1)) # it can change the key value pair
# print(d2.setdefault("Subham"))