Dictionaries in Python
Dictionaries in Python
d = {"name" : "Adrika",
"age": 14,
"class" : 9,
"d1": {"name" : "Anika", "age": 3, "class" : 2}}
# Dictionary is the unordered collection of data.
# l = ["Adrika", 5, 9]
print(d)
print(type(d))
dict1 = dict(name = "Adrika", age= 14)
print(dict1)
print(d["name"])
print(d["age"])
print(d["d1"])
# Adding data to the dictionary
user = {}
user["name"] = "Adrika"
user["songs"] = ["On", "Bulletproof", "Butter"]
print(user)
Post a Comment