can you please explain to me why this code:
if (x and y) and z > 0:
return True
isn't the same as:
if (x and y) > 0 < z:
return True
Basically, why cant I chain several variables like:
if var1 and var2 and var3 and var4 > 0:
do_this
What am I doing wrong?
--edit-- I suppose I just want to know how can I shorten the condition without writing:
if var1 > 0 and var2 > 0 and var3 > 0
especially if the condition is a long one like:
if var1 > (pow(x, 3) / 2.5*pow(y,0.5)+x*y)
if would be unfeasible to rewrite the condition for every variable, imagine if I had 10 of those vars. Or is there a better way which I am not seeing that could be used in situations like this? Thanks for answers!