1. Write a python program to add on the following dictionaries, dict_a, dict_b and dict_c to be a new dict_d
The output is:
dict_a={1:"Python", 2:"Is", 3:"Programming"}
dict_b={4:"Language", 5:"the", 6:"most"}
dict_c={7:"popular",8:"free", 9:"exercises"}
Expected Answer: The new dict_d: {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"} dict_b={4:"Language", 5:"the", 6:"most"} dict_c={7:"popular",8:"free", 9:"exercises"} dict_d = {} for i in (dict_a, dict_b, dict_c): dict_d.update(i) print("The new dict_d: ", dict_d)
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)