Dictionary in python

# dic={"1":"one", "2":"two" }
# print(dic)

a = {'key': 'value', 'cow':'mooh'}
print(a['cow'])
#will print "mooh" on the screen
# Dictionary is nothing but key value pairs
d1 = {}
# print(type(d1))
d2 = {"Harry":"Burger",
      "Rohan":"Fish",
      "SkillF":"Roti",
      "Shubham":{"B":"maggie", "L":"roti", "D":"Chicken"}}
# d2["Ankit"] = "Junk Food"
# d2[420] = "Kebabs"
# print(d2)
# del d2[420]
# print(d2["Shubham"])
# d3 = d2.copy()
# del d3["Harry"]
# d2.update({"Leena":"Toffee"})
# print(d2.keys())
# print(d2.items())f
i=0
while i< len(d2):
    
    print(d2)
    i=i+1
aman={"fist":"Aman", "Mid":"preet", "last":"singh"}
    
print(type(aman))

Comments