Every precedence table I look at for Python states the equality(==) operator is evaluated before the 'or' keyword. Why then is '1' printed for this code? I thought the expression would evaluate as false, and the if block wouldn't run.
number = 1
if number == 0 or 1:
print(number)
How about the following code? Why isn't 'False' printed? Instead, the integer 1 is printed. It confuses me how the variable 'a' gets assigned as 1 instead of as a False boolean value.
number = 1
a = (number == 0 or 1)
print(a)