While coding in Python, I realized I couldn't remember which is evaluated first:
and
(the logical conjunctive operator),
or
(the logical disjunctive operator).
Of course, I could've used parentheses (or looked it up), but I wanted to try to find out for myself. I tried endless combinations of False
, True
, and
, and or
but could not figure it out.
Given a language with unknown operator precedence, where operators of equal precedence evaluate left-to-right, find a way to conclusively determine whether the logical conjunction or the logical disjunction is evaluated first.
You can only use False
, True
, and
, and or
in your answer.
Note: You may assume that or
and and
definitely have different precedence.
and
left to right and then allor
left to right, or (2) evaluates allor
left to right and then alland
left to right? $\endgroup$and
andor
have different precedence? $\endgroup$