Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement the function merge_dict. The merge_dict function merges two dictionaries with the same keys together by adding up their values for the corresponding keys

 

Implement the function merge_dict. The merge_dict function merges two dictionaries with the same keys together by adding up their values for the corresponding keys and returning the resulting dictionary. def merge_dict (d1, d2): """Returns a dictionary that is the result of two dictionaries being merged together. Dictionaries are merged by adding up their values. You can assume that the same keys appear in both dictionaries. >>> data8 = {"midterms":1, "projects":3} >>>data100 = {"midterms": 2, "projects":3} >>> combined_exams = merge_dict (data8, data100) >>> combined_exams {'midterms': 3, 'projects': 6} >>> sunday_orders >>> monday_orders >>> combined_orders merge_dict (sunday_orders, monday_orders) >>> combined_orders {'pizza': 4, 'hot dogs': 3, 'fries': 13} || || || = {"pizza": 3, "hot dogs": 2, "fries":5} {"pizza": 1, "hot dogs": 1, "fries": 8} = "*** YOUR CODE HERE ***'

Step by Step Solution

3.34 Rating (145 Votes )

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

University Physics With Modern Physics

Authors: Wolfgang Bauer, Gary Westfall

2nd edition

73513881, 978-0073513881

More Books

Students also viewed these Computer Engineering questions