I have a problem with the min function. I'm trying to use it in an if statement in combination with the and operator. An easy example would be:
if min(1,2,3) == 2 and 3:
print(1)
My output here is actually 1 because it seems that the "==" checks the list rather than the value of min(). I tried to assign min(1,2,3) to a varible but it still did the same. I could obviously write my own min() function. But before I do this I would like to know if there's a way for my code to compare the the actual lowest value of the min() function with my 2 and 3 rather than comparing it with the arguments within the brackets.
Thanks for reading!
Edit: I forgot to mention that I searched for a solution online already but I couldn't figure it out
Another edit: I'll try to explain it differently: I'm basically calculating 3 different Values and assign them to Variables. I use the lowest of them for further calculations this is why I use the min function in the first Place. Afterwars I want create a list where I store the information which of the three variables was the lowest for the current calculation. (I'm trying to do this with multiple if statements because all 3 variables could have the same Value). So what I do is:
list = []
if min(v1, v2, v3) == v1:
list.append(1)
Why I append one is irrelevant but the problem is, that it alway appends one even though v1 is not the lowest value of the given three variables. So the if statement is alway executed. Sorry that it wasn't clear in the first place.
solution: so I just read the comments and one said (min(1,2,3) == 1) could work and it actually did. I don't really understand why as I'm fairly new to programming but if it works I'm happy. So thank you very much!