In JavaScript, this:
0 < 5 < 3
is evaluated like this:
(0 < 5) < 3
which translates to this:
true < 3
which is further translated to this (because true
is 1
in a numerical context):
1 < 3
which is true.
Python however was designed differently. As documented here, it interprets this:
0 < 5 < 3
as being equivalent to this:
0 < 5 and 5 < 3
The above expression can be further translated to this:
True and False
which is false.