Unit 2 Session 1 (Click for link to problem statements)
Understand what the interviewer is asking for by using test cases and questions about the problem.
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Loop through each item in catalog 2, and add/overwrite the entry in catalog 1.
1) For each product and price in catalog 2:
a) Set that product -> that price in catalog 1
2) Return the updated catalog 1
def merge_catalogs(catalog1, catalog2):
for product, price in catalog2.items():
catalog1[product] = price
return catalog1