[Tutor] mnemonics to better learn Python
Che M
pine508 at hotmail.com
Fri Jul 31 20:27:57 CEST 2009
> To: tutor at python.org
> From: alan.gauld at btinternet.com
> Date: Fri, 31 Jul 2009 17:09:48 +0100
> Subject: Re: [Tutor] mnemonics to better learn Python
>
>
> "Eduardo Vieira" <eduardo.susan at gmail.com> wrote
>
> > Hello, would anybody have a good memorization technique for boolean
> > results? Like when using 'or'/'and' what it returns when both are
> > false, the last is false, etc?
>
> Hmm, I don't try to remember those, I just work it out based on
> the meaning.
>
> A and B is true only if both A and B are True
> A or B is true if either A or B is True.
>
> Thats it really, what's to remember?
I tend to agree, but since he asked for a mnemonic...
What Python Needs to Return a Boolean
AND: Both I demand!
OR: One or more.
So,
if A and B are False:
[think "Both I demand...are False")
if A or B are False:
[think "One or more...are False")
if A and B are True:
[think "Both I demand...are True")
etc.
Che
_________________________________________________________________
Windows Live™ SkyDrive™: Store, access, and share your photos. See how.
http://windowslive.com/Online/SkyDrive?ocid=TXT_TAGLM_WL_CS_SD_photos_072009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090731/13f277f7/attachment.htm>
More information about the Tutor
mailing list