Re: [Tutor] Boolean question

2011-03-16 Thread Donald Bedsole
Hi Jack, On Wed, Mar 16, 2011 at 1:50 AM, Jack Trades jacktradespub...@gmail.com wrote: On Wed, Mar 16, 2011 at 12:22 AM, Donald Bedsole drbeds...@gmail.com wrote: not (False and True) Python evaluates it as True 1)You evaluate what's in the parentheses first.  A thing can not be false

Re: [Tutor] Boolean question

2011-03-16 Thread Jack Trades
On Wed, Mar 16, 2011 at 1:24 AM, Donald Bedsole drbeds...@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.

Re: [Tutor] Boolean question

2011-03-16 Thread Alan Gauld
Donald Bedsole drbeds...@gmail.com wrote most part. But, could someone make sure I'm understanding this one expression correctly? not (False and True) Python evaluates it as True Is it because: 1)You evaluate what's in the parentheses first. A thing can not be false and true at the same

Re: [Tutor] Boolean question

2011-03-16 Thread Donald Bedsole
Hi Allen, Boolean algebra can be a weird thing to get your head around the first time you come across it :-) Yes, :-) Here are some of the standard rules: True and thing = thing False and thing = False True or thing = True False or thing = thing Thanks for your response and for the

Re: [Tutor] Boolean question

2011-03-16 Thread bob gailer
On 3/16/2011 4:26 PM, Donald Bedsole wrote: Hi Allen, Boolean algebra can be a weird thing to get your head around the first time you come across it :-) Yes, :-) Here are some of the standard rules: True and thing = thing False and thing = False True or thing = True False or thing = thing

Re: [Tutor] Boolean question

2011-03-16 Thread Donald Bedsole
On Wed, Mar 16, 2011 at 5:53 PM, bob gailer bgai...@gmail.com wrote: Thing in this context means 'anything. could be a string, number, list, any Python object. Ok, thanks Bob. ___ Tutor maillist - Tutor@python.org To unsubscribe or change

Re: [Tutor] Boolean question

2011-03-16 Thread Donald Bedsole
Hi Jack, On Wed, Mar 16, 2011 at 1:55 AM, Jack Trades jacktradespub...@gmail.com wrote: 'and' evaluates one argument at a time and returns immediately if the argument is False. And or works in the inverse manner? It evaluates one argument at a time and returns immediately if the argument

Re: [Tutor] Boolean question

2011-03-16 Thread Alan Gauld
Donald Bedsole drbeds...@gmail.com wrote The first argument was True, so True was returned and negated by the not with a final result of False for the expression. Is this correct? Yes. Its called Short Circuit Evaluation. You will find an explanation on the Functional Programming topic of my

Re: [Tutor] Boolean question

2011-03-16 Thread Alan Gauld
Donald Bedsole drbeds...@gmail.com wrote False or thing = thing Thanks for your response and for the rules, but for some reason I'm not understanding. In the above quote, what is meant by thing? Any Boolean value, and in Python that means pretty much anything at all because Python has a

Re: [Tutor] Boolean question

2011-03-15 Thread Jack Trades
On Wed, Mar 16, 2011 at 12:22 AM, Donald Bedsole drbeds...@gmail.comwrote: not (False and True) Python evaluates it as True Is it because: 1)You evaluate what's in the parentheses first. A thing can not be false and true at the same time, so the answer is false. Yes, the expression in