[Tutor] mnemonics to better learn Python
robert.lummis at gmail.com
Fri Jul 31 18:27:37 CEST 2009
Understand that "if A or B" is short for the phrase "if either A or B
is true", or more fully "if A is true or B is true". When I add "is
true" then the logic seems obvious to me without memorizing anything.
Likewise, "if A and B" means "if A and B are both true", which is the
same as "if A is true and B is true".
On Fri, Jul 31, 2009 at 12:09 PM, Alan Gauld<alan.gauld at btinternet.com> wrote:
> "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 guess for a non native English speaker it might be more difficult because
> you need to translate and/or into the native language?
> But I assume every language has an equivalent for both of those concepts?
> In hardware engineering its more complex because you have nand and nor gates
> to deal with too, but they don't apply in software - at least not directly.
> Alan Gauld
> Author of the Learn to Program web site
> Tutor maillist - Tutor at python.org
More information about the Tutor