0

As expressions are executed left to right but when I execute this given double equality it gives me false but it should be True if executed left to right.

print(1<0<1)

left to right it should be executed like this.

# 1<0 = False(0),

then

# 0<1 = True(1)

so the expression becomes True and I get False.

farhan jatt
  • 509
  • 1
  • 8
  • 31

1 Answers1

1

It is weird but Python does not executes it left to right. It is executed as

print(1<0 and 0<1)

so as left of and is false which makes whole equation false due to and operator. This is the reason you are getting False.

Prince Hamza
  • 1,090
  • 12
  • 21