Snippet
def increment_values(dct):
for key in dct:
= dct[key]
value
if type(value) == int:
= value + 1
dct[key]
elif type(value) == dict:
increment_values(value)
= {'a': 1, 'b': 2, 'c': 3}
dct1
increment_values(dct1)print(dct1)
= {'x': {'a': 5}, 'y': {'a': 1, 'b': 2}, 'z': {'b': 3}}
dct2
increment_values(dct2)print(dct2)
Solution
Image Description
(Coming Soon)