I have dictA {'1': 3, '3': 0, '2', 1}
and dictB {'2': 0, '1': 1, '3', 4}
Both dictionaries will always be the same length, but the order of their key/value pairs may vary.
How do I merge dictA
with dictB
and sum the values according to the keys?
The output, from above, would be:
{'1': 4, '3', 4, '2', 1}
(order of the key/value pairs doesn't matter)