Re: Boolean Expressions

2017-09-28 Thread Joel Goldstick
On Wed, Sep 27, 2017 at 5:21 AM, Cai Gengyang wrote: > On Wednesday, September 27, 2017 at 1:01:50 PM UTC+8, Cameron Simpson > wrote: > > On 26Sep2017 20:55, Cai Gengyang wrote: > > >On Wednesday, September 27, 2017 at 6:45:00 AM UTC+8, Cameron Simpson > wrote: > > >> On 26Sep2017 14:43, Cai Gen

Re: Boolean Expressions

2017-09-27 Thread Cai Gengyang
On Wednesday, September 27, 2017 at 1:01:50 PM UTC+8, Cameron Simpson wrote: > On 26Sep2017 20:55, Cai Gengyang wrote: > >On Wednesday, September 27, 2017 at 6:45:00 AM UTC+8, Cameron Simpson wrote: > >> On 26Sep2017 14:43, Cai Gengyang wrote: > >> >C) Set bool_three equal to the result of > >> >

Re: Boolean Expressions

2017-09-26 Thread Cameron Simpson
On 26Sep2017 20:55, Cai Gengyang wrote: On Wednesday, September 27, 2017 at 6:45:00 AM UTC+8, Cameron Simpson wrote: On 26Sep2017 14:43, Cai Gengyang wrote: >C) Set bool_three equal to the result of >19 % 4 != 300 / 10 / 10 and False > 19 % 4 = 3 which is equal to 300 / 10 / 10 = 3, hence the

Re: Boolean Expressions

2017-09-26 Thread Gregory Ewing
Cai Gengyang wrote: So does that mean that the way 'and' works in Python is that both terms must be True (1) for the entire expression to be True ? Why is it defined that way, weird ? It's not weird, it's the normal meaning of "and" in English. Do I have purple hair? No. Do I have three nostri

Re: Boolean Expressions

2017-09-26 Thread Cai Gengyang
On Wednesday, September 27, 2017 at 6:45:00 AM UTC+8, Cameron Simpson wrote: > On 26Sep2017 14:43, Cai Gengyang wrote: > >Help check if my logic is correct in all 5 expressions > > Why not just run some code interactively? Unless this is entirely a thought > exercise to verify that you have a so

Re: Boolean Expressions

2017-09-26 Thread Steve D'Aprano
On Wed, 27 Sep 2017 08:23 am, Cai Gengyang wrote: > > I'm trying to understand the logic behind AND. I looked up Python logic tables > > False and False gives False > False and True gives False > True and False gives False > True and True gives True. > > So does that mean that the way 'and' wor

Re: Boolean Expressions

2017-09-26 Thread Thomas Jollans
On 27/09/17 00:23, Cai Gengyang wrote: > I'm trying to understand the logic behind AND. I looked up Python logic tables > > False and False gives False > False and True gives False > True and False gives False > True and True gives True. > > So does that mean that the way 'and' works in Python is t

Re: Boolean Expressions

2017-09-26 Thread Irv Kalb
> > On Sep 26, 2017, at 3:23 PM, Cai Gengyang wrote: > > > I'm trying to understand the logic behind AND. I looked up Python logic tables > > False and False gives False > False and True gives False > True and False gives False > True and True gives True. > > So does that mean that the way 'a

Re: Boolean Expressions

2017-09-26 Thread Irmen de Jong
On 09/27/2017 12:23 AM, Cai Gengyang wrote: > > I'm trying to understand the logic behind AND. I looked up Python logic tables > > False and False gives False > False and True gives False > True and False gives False > True and True gives True. > > So does that mean that the way 'and' works in P

Re: Boolean Expressions

2017-09-26 Thread Cameron Simpson
On 26Sep2017 15:23, Cai Gengyang wrote: I'm trying to understand the logic behind AND. I looked up Python logic tables False and False gives False False and True gives False True and False gives False True and True gives True. So does that mean that the way 'and' works in Python is that both

Re: Boolean Expressions

2017-09-26 Thread Cameron Simpson
On 26Sep2017 14:43, Cai Gengyang wrote: Help check if my logic is correct in all 5 expressions Why not just run some code interactively? Unless this is entirely a thought exercise to verify that you have a solid mental understanding of Python semantics, all your reasoning is easy to test.

Re: Boolean Expressions

2017-09-26 Thread Rob Gaddi
On 09/26/2017 03:23 PM, Cai Gengyang wrote: I'm trying to understand the logic behind AND. I looked up Python logic tables False and False gives False False and True gives False True and False gives False True and True gives True. So does that mean that the way 'and' works in Python is that bo

Re: Boolean Expressions

2017-09-26 Thread Cai Gengyang
I'm trying to understand the logic behind AND. I looked up Python logic tables False and False gives False False and True gives False True and False gives False True and True gives True. So does that mean that the way 'and' works in Python is that both terms must be True (1) for the entire expr

Re: Boolean Expressions

2017-09-26 Thread sohcahtoa82
On Tuesday, September 26, 2017 at 2:54:32 PM UTC-7, Chris Angelico wrote: > On Wed, Sep 27, 2017 at 7:43 AM, Cai Gengyang wrote: > > Help check if my logic is correct in all 5 expressions > > > > > > A) Set bool_one equal to the result of > > False and False > > > > Entire Expression : False and F

Re: Boolean Expressions

2017-09-26 Thread Chris Angelico
On Wed, Sep 27, 2017 at 7:43 AM, Cai Gengyang wrote: > Help check if my logic is correct in all 5 expressions > > > A) Set bool_one equal to the result of > False and False > > Entire Expression : False and False gives True because both are False This is not correct, and comes from a confusion in