Python program to add a key in a dictionary.

In this python dictionary program, we will add a key in a dictionary to make a new dictionary.

Steps to solve the program
  1. Take a dictionary as input.
  2. Add a key in the given dictionary using update().
  3. Print the output.
				
					dict1 = {1:'a',2:'b'}

dict1.update({3:'c'})

print(dict1)
				
			

Output :

				
					{1: 'a', 2: 'b', 3: 'c'}
				
			

dictionary in python using values.

concatenate two dictionaries

Leave a Comment