> To: [email protected]
> From: [email protected]
> Date: Fri, 31 Jul 2009 17:09:48 +0100
> Subject: Re: [Tutor] mnemonics to better learn Python
> 
> 
> "Eduardo Vieira" <[email protected]> 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
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to