1a = {
2 "a": 1,
3 "b": 2,
4 "c": 3
5}
6
7b = {
8 "a": 2,
9 "b": 3,
10 "d": 5
11}
12
13# Python 3.5
14
15for key in b:
16 if key in a:
17 b[key] = b[key] + a[key]
18
19c = {**a, **b}
20print(c)
21
22>>> c
23{'a': 3, 'b': 5, 'c': 3, 'd': 5}