In this python dictionary program, we will concatenate two dictionaries to form a one dictionary.
Steps to solve the program
- Take two dictionaries as input.
- Concatenate two dictionaries to form a single dictionary using update().
- 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'}