Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
You don't need it. You are working with data, not variable names.
Game, but this is "what you need":
a = 0
b = 1
c = 2
d = 3
alls = min(a, b, c, d)
globs = globals().copy()
for i in globs:
if id(globs[i]) == id(alls):
print("имя переменной, у которой самый маленький int:", i)
break
min , max , and others only return the minimum value, not the name of the variable with the minimum.
You can simply define your own variable denoting the minimum number
min_num = min(a,b,c,d)
---------------------------------
Caution! Shitcode!
---------------------------------
l = locals()
print([i for i in l if l[i] == 0][0])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question