xxxxxxxxxx
{'Dartmoor': ['moss', 'bog', 'orchids'], 'Exmoor': ['heather', 'gorse'], 'PeakDistrict': ['orchids', 'knapweed', 'moss']}
xxxxxxxxxx
#adding new key in python
List_of_Students = {"Jim" : "Roll-32"+","+ "Priority-First",
"Yeasin": "Roll-33"+","+ "Priority-2nd",}
List_of_Students.update({"Pinky": "Roll-34"})
for x in List_of_Students:
print(x)
#That will show only the the key
xxxxxxxxxx
diction = {'key':'value'}#Adding a dictionary called diction.
print(diction)
diction['newkey']='newvalue'#Adding the newkey key to diction with its value.
print(diction)
#output: {'key':'value','newkey':'newvalue'}
xxxxxxxxxx
d = {'key': 'value'}
print(d)
# {'key': 'value'}
d['mynewkey'] = 'mynewvalue'
print(d)
# {'key': 'value', 'mynewkey': 'mynewvalue'}