In this post we will be adding new data to an existing dictionary in Python. Dictionaries are a means of storing data, data here is stored in two parts whereby there is a key and a value.
See below a sample of our dictionary in this example, where the key is the name of the month and the value represents the number of sales made.
Dict = {'Jan': 12, 'Feb': 16, 'Mar': 19, 'Apr': 22}
In this example we will be adding the month of ‘May’ along with its sales figure to our dictionary, see the snippet of code below as an example.
Dict ['May'] = '26'
print(Dict)
The output would display our updated list, which would be seen as.
{'Jan': 12, 'Feb': 16, 'Mar': 19, 'Apr': 22, 'May': '26'}
>>>