Answer:
# We define the function merg_dict with the two dictionaries d1 and d2 that it #will take.
def merge_dict(d1,d2):
for key in d2:
if key in d1:
d1[key] = d1[key] + d2[key]
else:
d1[key] = d2[key]
return d1
# We define the parameters of the dictionary d1 and d2
d1 = {'a': [1, 2, 3], 'b': [2, 2, 2], 'c': [1,2,3]}
d2 = {'a': [4,4,4], 'c': [3,3,3]}
#Next we call on the function merge_dict
print(merge_dict(d1,d2)
We'll obtain the following as output:
{'a': [1,2,3,4,4,4], 'b': [2,2,2], 'c': [1,2,3,3,3,3]}