In this python dictionary program, we will add a key in a dictionary to make a new dictionary.
Steps to solve the program
- Take a dictionary as input.
- Add a key in the given dictionary using update().
- Print the output.
dict1 = {1:'a',2:'b'}
dict1.update({3:'c'})
print(dict1)
Output :
{1: 'a', 2: 'b', 3: 'c'}