Fwd: Operator Precedence/Boolean Logic

Jorge Gimeno jlgimeno71 at gmail.com
Tue Jun 21 23:56:21 EDT 2016


On Tue, Jun 21, 2016 at 8:40 PM, Elizabeth Weiss <cake240 at gmail.com> wrote:

> Hi There,
>
> I am a little confused as to how this is False:
>
> False==(False or True)
>
> I would think it is True because False==False is true.
>
> I think the parenthesis are confusing me.
>
> (False==False) or True
>
> This is True. Is it because False==False? And True==False is not True but
> that does not change that this is True.
>
> If someone could please explain as I am teaching Python to myself and am
> stuck on this that would be great.
> Thank you for your help!
> --
> https://mail.python.org/mailman/listinfo/python-list
>

You have 2 comparisons here .  The first is inside the parenthesis, (False
or True) evaluates to True.  What remains of the expression is False ==
True, which is False.

-Jorge
(Reposted because I replied to the OP directly, instead of to the list)



More information about the Python-list mailing list