Re: [Tutor] Boolean question

2011-03-16 Thread Alan Gauld
"Donald Bedsole" 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 set of rules ove

Re: [Tutor] Boolean question

2011-03-16 Thread Alan Gauld
"Donald Bedsole" 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 tutor HT

Re: [Tutor] Boolean question

2011-03-16 Thread Donald Bedsole
Hi Jack, On Wed, Mar 16, 2011 at 1:55 AM, Jack Trades 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 is [True]." ? For examp

Re: [Tutor] Boolean question

2011-03-16 Thread Donald Bedsole
On Wed, Mar 16, 2011 at 5:53 PM, bob gailer 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 subscription options

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
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 fo

Re: [Tutor] Boolean question

2011-03-16 Thread Alan Gauld
"Donald Bedsole" 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 time, so the answ

Re: [Tutor] Boolean question

2011-03-15 Thread Jack Trades
On Wed, Mar 16, 2011 at 1:24 AM, Donald Bedsole 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-15 Thread Donald Bedsole
Hi Jack, On Wed, Mar 16, 2011 at 1:50 AM, Jack Trades wrote: > On Wed, Mar 16, 2011 at 12:22 AM, Donald Bedsole > 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 and true at the same time,

Re: [Tutor] Boolean question

2011-03-15 Thread Jack Trades
On Wed, Mar 16, 2011 at 12:22 AM, Donald Bedsole wrote: > > 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 the paren

[Tutor] Boolean question

2011-03-15 Thread Donald Bedsole
Hi folks, I'm working on Boolean Operators right now, and I'm getting it for the 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 ca