boolean logic - Why does Python behave this way? -
i trying figure out why python 2.7 behaves way below code.
>>> = true >>> b = 5<6 >>> == b true
what beingness tested here? help much appreciated
what beingness tested
(5<6) == true
which same testing
5<6
and should obvious true, , python agrees:
>>> 5<6 true
writing in complex way shown in question makes no sense really, @ to the lowest degree far python code concerned. it's bad code, unless there esoteric external requirement write that.
if wondering is, why python that, reply is: when run python
command called repl, or read-eval-print-loop. repl that: every line of input give it, automatically prints result of lastly look in line. , >>>
python's interactive prompt, indicating in repl mode.
python boolean-logic
No comments:
Post a Comment