I'd like to add the values of a dictionary to another dictionary. For example:
adict = {1: {'a': 13, 'b': 19, 'c': 15}, 2: {'a': 7, 'b': 2, 'c': 0}}
If we add {1: {'a': 3, 'b': 9, 'c': 23}}
to adict
Then adict should now be:
{1: {'a': 16, 'b': 28, 'c': 38}, 2: {'a': 7, 'b': 2, 'c': 0}}
If we add {3: {'a': 4}}
then adict should now be:
{1: {'a': 16, 'b': 28, 'c': 38}, 2: {'a': 7, 'b': 2, 'c': 0}, 3: {'a': 4}}
and if we add {2: {'a': 1, 'b': 8, 'c': 27, 'd': 11}}
Then adict should now be:
{1: {'a': 16, 'b': 28, 'c': 38}, 2: {'a': 8, 'b': 10, 'c': 27, 'd': 11}, 3: {'a': 4}}
What's the best way to do this?