Python program to concatenate two dictionaries to from a single dictionary

In this python dictionary program, we will concatenate two dictionaries to form a single dictionary.

Steps to solve the program
  1. Take two dictionaries as input.
  2. Concatenate two dictionaries using update().
  3. Print the output.
				
					dict1 = {'name':'yash','city':'pune'}
dict2 =  {'course':'python','institute':'sqatools'}

dict1.update(dict2)

print(dict1)
				
			

Output :

				
					{'name': 'yash', 'city': 'pune', 'course': 'python', 'institute': 'sqatools'}
				
			

add a key in a dictionary.

swap the values of the keys in the dictionary.

Leave a Comment