Answers for "how to add a key and a value to a dictionary in python\"

0

how to add a key and a value to a dictionary in python\

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'}
Posted by: Guest on October-07-2021

Code answers related to "how to add a key and a value to a dictionary in python\"

Python Answers by Framework

Browse Popular Code Answers by Language