Skip to content

NeelkanthMehta/030-join-dicts

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Write a Python program to combine two dictionary adding values for common keys.

Define a function that takes 2 dictionaries as its parameters and returns a dictionary. The dictionary should have all the keys of the original dictionaries and common keys should have the sum of their values.

Example:

Input

d1 = {'a': 100, 'b': 200, 'c':300}
d2 = {'a': 300, 'b': 200, 'd':400}

Output

{'b': 400, 'd': 400, 'a': 400, 'c': 300}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%