1

Consider a = 3. Now, why is the result of the expression a == 3 > 1 True ?

It should be equivalent to either (a == 3) > 1 or a == (3 > 1). Both these expressions are False . Then why is the first one True ?

asker
  • 19
  • 4
  • This is called "operator chaining". See the [linked answer](https://stackoverflow.com/a/48315871/4909087) – cs95 Dec 29 '18 at 14:24
  • Here we have 'operator chaining'. Look the operation as: '(3==3) and (3>1)',which equals True and True , hence output is True. First interpreter is comparing (3==3) which is True then it is comparing (3>1) which is also True. Hence the output is True. Operator chaining in one sentence is: if any operation in chain return False then the output is False else it is True. – Utsav Dec 29 '18 at 14:35

0 Answers0