create a dictionary dict3 as follows: dict3 = {**dict1, **dict2}
Now loop for key, value in dict3.items and find the same keys that are in dict1 and dict2 and zip the value of dict3 and dict1[key] and assign the result to dict3[key].
I have defined a function that returns dict3 and test it with your dict1 and dict2.
The result is exactly the same as your Merged_dict!
We have a strict “we won’t do your homework for you” policy on the forum. What code have you written so far? If you post that code, we can help you fix it.
So to rephrase it:
You are looking for a dictionairy where the values of all keys are the sum of the values in the array-indices in each dictionairy IF the key is both OR just the array else.
If you know how to adress key-value in a dict, this shouldn’t be to hard.