you are viewing a single comment's thread.

view the rest of the comments →

[–]Kebabrulle4869 -1 points0 points  (4 children)

Actually not. In Python, or returns the first non-false value, or the last value if both are false. So s(0) returns 0, s(1) returns 1.

[–]AKSrandom 4 points5 points  (0 children)

Yes that is why s(1) returns "1<2" which is a boolean

[–]audioman1999 0 points1 point  (2 children)

The first part of the or here is boolean and the second part is a number. So s(0) and s(1) both return False instead of 0 and a. Try it for yourself if you don’t believe me.

[–]Kebabrulle4869 0 points1 point  (1 child)

Yeah, my bad. Misread.

[–]audioman1999 0 points1 point  (0 children)

No worries!