Question: 5. Create a function which concatenates two dictionaries. If the two dictio- naries have the same key then their values should be added. Perform the

5. Create a function which concatenates two dictionaries. If the two dictio- naries have the same key then their values should be added. Perform the following test cases: 1) if the two dictionaries are {"a": 1, "b": 2} and {"d": 4} then the func- tion should return {'a': 1, 'b': 2, 'd': 4} 2) if the two dictionaries are {"a": 1, "b": 2} and {"a":3, "d": 4} then the function should return {'a': 4, 'b': 2, 'd': 4} [1%]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
