How to find the maximum variable in a list in python
So here is my code -
var1 = 1
var2 = 2
var3 = 3
varList = [var1, var2, var3]
I want to find which variable has the highest value but then get the variable. This means that I can't use max because the value would be 3 instead of var3, but I want var3.
you can't actually know the variable names, it just won't work
use something like a dict:
of course, that is the closest you will get.
It just isn't practical to be able to get the variable, 100% of the time it's a mistake.