apend only key in dictionary in python code example
Example 1: how to set a key of dict in python
dictionary={'Hello':3,'World!':4}
def dict_add(obj,key,value):
obj[key]=value
reutrn obj
dict_add(dictionary,'Python',10)
print (dictionary)
Example 2: Python dictionary append
testing1={'one':1,'two':2}
''' update() is the method of dict() merges another dict into existing ones '''
''' it replaces the keys of exisiting ones with the the new ones '''
testing1.update({'two':3,'noice':69})
print(testing1) """ {'one':1,'two':3,'noice':69} """