I’m newish to Python (and stackoverflow)…bear with me! I have a dictionary that looks like this:
valueDict[i] = [x,y]
I want to find the minimum key based on the sum of x and y. I know for a dictionary of values I can use:
minVal = min(valueDict, key=valueDict.get)
But I don’t think I can modify this approach for a dict of lists.
You can provide any function for the
keyargument ofmin. For a dictionary of values you doIf you wanted to the minimum based on the sum, you might do