Get highest value of JSON Python

Trying to get the highest value of a letter is kind of hard. When trying this, I get as a result the letter ‘z’. How can I make it that it will return ‘y’ as the highest value?

Here’s what I tried:

modes = {'x': 73, 'y': 2179, 'z': 173}



>Solution :

You can achieve that using the key argument:

 max(modes, key=lambda k: modes[k])

Leave a Reply