Boolean Expressions

Cai Gengyang gengyangcai at gmail.com
Wed Sep 27 05:21:53 EDT 2017


On Wednesday, September 27, 2017 at 1:01:50 PM UTC+8, Cameron Simpson wrote:
> On 26Sep2017 20:55, Cai Gengyang <gengyangcai at gmail.com> wrote:
> >On Wednesday, September 27, 2017 at 6:45:00 AM UTC+8, Cameron Simpson wrote:
> >> On 26Sep2017 14:43, Cai Gengyang <gengyangcai at gmail.com> 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 first term is 
> >> False. Entire expression is then equal to True, because False and False = 
> >> True
> >>
> >> Entire expression is False because the left hand side is False.
> >
> >Am I missing something here ? 19 % 4 = 19 modulo 4 equals to 3 right ? which 
> >equals the right hand side , hence first term is True
> 
> But the test is for "!=", not "==". So False.
> 
> Cheers,
> Cameron Simpson <cs at cskk.id.au> (formerly cs at zip.com.au)

Right ... I didn't see the ' =! '



More information about the Python-list mailing list