Mega Code Archive

 
Categories / Python Tutorial / Operator
 

Multiple comparisons can be made on the same line, evaluated in left-to-right order

print 3 < 4 < 7           # same as ( 3 < 4 ) and ( 4 < 7 ) print 4 > 3 == 3          # same as ( 4 > 3 ) and ( 3 == 3 ) print 4 < 3 < 5 != 2 < 7