So I've looked into some similar questions but I couldn't find an answer, suitable for my problem. I have a nested dictionary and I need to sort the keys of the whole dictionary by the sum of the values of the nested dictionaries, but in reversed order:
So from:
dict = {Sarah : {apple: 1, pear: 2}, John: {tomato: 5, cucumber: 5}, Dany: {carrot: 1}}
I need to get to:
dict = {Dany: {carrot:1}, Sarah: {apple: 1, pear: 2}, John: {tomato: 5, cucumber: 5}}
I figured I could maybe do this with dict(sorted(), key, reverse=True), but I am unable to formulate correctly the key because I don't understand how can I access the inner values of the nested dictionaries.
I'd be grateful for your help!