Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created July 10, 2020 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/be083526ce6f011a53bad73731cec8cf to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/be083526ce6f011a53bad73731cec8cf to your computer and use it in GitHub Desktop.
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