0
not quiet clearly for me
what exactly happened if I type print(2+1 or 4). is it make sense? or it is rave?
2 Respuestas
+ 2
+ operator has a higher precedence them the or operator and thus 2+1 is calculated first.
Now you have "3 or 4". The or operator will return the first value if that value is interpreted as true, ou the second value otherwise. Since a nonzero number counts as true then the code will print 3.
If the code was "print(2-2 or 4)" then it would print 4.
0
thanks a lot!