how to add value to dict in python code example
Example 1: dictionary append value python
d = {1:2}
d.update({2: 4})
print(d) # {1: 2, 2: 4}
Example 2: add value to dictionary python
dict[key] = value
d = {1:2}
d.update({2: 4})
print(d) # {1: 2, 2: 4}
dict[key] = value