Program to concatenate two dictionaries

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

Steps to solve the program
  1. Take two dictionaries as input.
  2. Concatenate two dictionaries to form a single dictionary using update().
  3. Print the output.
				
					dict1 = {'Name':'Harry','Rollno':345,'Address':'Jordan'}
dict2 = {'Age':25,'salary': '$25k'}

dict1.update(dict2)

print(dict1)
				
			

Output :

				
					{'Name': 'Harry', 'Rollno': 345, 'Address': 'Jordan', 'Age': 25, 'salary': '$25k'}
				
			

move items from dict1 to dict2.

get a list of odd and even keys from the dictionary

Leave a Comment