Basic Doubt in syntax

Can anyone tell what is the difference between following two code?

if i == 7 or 10

if i == 7 or i ==10

1 Like

The first will always return true. It is evaluated as:
if (i == 7) or 10
… and 10 is evaluated to True in Python.

The second one will only evaluate to True if i equals 7 or i equals 10, which is probably what you need.


thankyou so much man I know it was silly but was little confused