[Tutor] Boolean question
Jack Trades
jacktradespublic at gmail.com
Wed Mar 16 07:30:38 CET 2011
On Wed, Mar 16, 2011 at 1:24 AM, Donald Bedsole <drbedsole at gmail.com> wrote:
>
> Ok, so, as another example:
>
> not(True and False) is "True"
>
> because: the first argument "True" is true, and the second argument
> "False" when returned is negated by "not" becomes "not False" which
> evaluates to True?
>
>
Correct. When Python sees (True and False) it first evaluates True, which
is obviously True. Because the first argument was not False, it continues
on and evaluates False. At this point Python stops evaluating anything else
(for example if you had (True and False and True)) and returns False, which
is then negated by 'not'.
--
Jack Trades
Pointless Programming Blog <http://pointlessprogramming.wordpress.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110316/a66a25f8/attachment.html>
More information about the Tutor
mailing list