python dictionary add key-value pair
dict = {'key1':'value_one', 'key2':'value_two'}
dict['key3'] = 'value_three'
python dictionary add key-value pair
dict = {'key1':'value_one', 'key2':'value_two'}
dict['key3'] = 'value_three'
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'}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us