Question: Write a Python function merge _ dictionaries that takes two dictionaries and returns a new dictionary containing all the keys from both dictionaries. If a
Write a Python function mergedictionaries that takes two dictionaries and returns a new dictionary containing all the keys from both dictionaries.
If a key exists in both dictionaries, the value in the new dictionary should be a list containing both values.
Test: mergedictionariesa: b: b: c: should return a: b: c:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
