Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created Jul 10, 2020
Embed
What would you like to do?
d={'name':'karthi',
'age':7,
'city':'chennai',
}
print (d)#Output:{'name': 'karthi', 'age': 7, 'city': 'chennai'}
#Assigning values. If key already exists in the dictionary means,it will update value.
d['age']=8
print (d)#Output:{'name': 'karthi', 'age': 8, 'city': 'chennai'}
#Assigning values.If key doesn't exists in the dictionary means,it will add that key.
d['rollno']=12
print (d)#Output:{'name': 'karthi', 'age': 8, 'city': 'chennai', 'rollno': 12}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment