# Multiply of 2 integers using if then statements
num1 = int(input("Please enter 1st number: "))
num2 = int(input("Please enter 2nd number: "))
result = num1 * num2
if num1 or num2 > 1000:
print("Error: Number(s) is greater than 1000, restart program and try again.")
else:
print("The result is: ", result)

I have tried switching the if then statements around but cannot get the result to display correctly. The first statement works but the 2nd one just displays the first if print.

Its suppose to if a number entered is greater 1000 then its errors out, if they are less than 1000 it multplies them to display the result. If i switch them around and change the first statement then it multplies them and displays the result, but does not error out if a number is greater than 1000.

An expression with multiple operations, like num1 or num2 > 1000, without parentheses, determines the order in which those operations are applied according to some convention. In this case one that depends on the programming language.

See how > appears before or in the table. So, it gets applied first and the result of it then gets or with num1.

The result of num2 > 1000 could be True or False, but if num1 is non-zero, then the value of num1 or num2 > 1000, which is that of num1 or (num2 > 1000) will be True.