Skip to content

Problem 3

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

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

Output: Counter({'a': 400, 'b': 400, 'd': 400, 'c': 300})