Print the highest value variable


I know how to find the highest number in a set but i want to know how to get the variable name of that number.

Here is my code:

number1 = 1
number2 = 4
number3 = 3

largest = max(number1,number2,number3)
print largest

It prints “4” but i want it to print “number2” instead. How can I accomplish this?



I’d maybe use a dictionary

d = {'number1': 4098, 'number2': 4139, 'number3':222}

largest = ""
num = 0
for x,f in d.items():
    k = f
    if k > num:
        largest = x