I am trying to find the key of element which has the highest value. The values are another dictionary, so the method mentioned over here: Getting key with maximum value in dictionary? cannot be used.
The structure is like this:
{'a': {'points': 7, 'difference': 0}, 'b': {'points': 6, 'difference': 1}, 'c': {'points': 4, 'difference': -3}, 'd': {'points': 7, 'difference': 2}}
The element which has the most number of points should be the max element, and if points are same then the element with the larger difference should be chosen.
So the max element in this case is d.
I know I can I use for loop and find the maximum element, but is there any other way to do it?