5. Write a python program to combine two separate Python dictionary, dict_a and dict_b as one Python dictionary.
The output is:
dict_a={1:"Python", 2:"Is", 3:"Programming", 4:"Language", 5:"the"}
dict_b={6:"most", 7:"popular",8:"free", 9:"exercises"}
Expected Answer:
{1: 'Python', 2: 'Is', 3: 'Programming', 4: 'Language', 5: 'the', 6: 'most', 7: 'popular', 8: 'free', 9: 'exercises'}
Sample Answer:
dict_a={1:"Python", 2:"Is", 3:"Programming", 4:"Language", 5:"the"} dict_b={6:"most", 7:"popular",8:"free", 9:"exercises"} new_dict = dict_a.copy() new_dict.update(dict_b) print(new_dict)
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)