[Tutor] mnemonics to better learn Python
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.
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")
Windows Live™ SkyDrive™: Store, access, and share your photos. See how.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor