Conditionals & Control Flow


#1

Hi,

I got to a part where I'm asked to set True or False for statements.

I got this statement and I can't see the reason in the outcome being True where I see a False.

(Set bool_two equal to the result of False and not True or True)

The way I see it, I took apart the right side of 'and' so I got False or True which is True, than I got left with the left side of And and there's just False and True which comes out False, but the class insists it's True.

Anyone can help please?


#2

Sorry. I found out why..... it's the order of the operators which is as followed:

Boolean Operators

True and True is True

True and False is False

False and True is False

False and False is False

True or True is True

True or False is True

False or True is True

False or False is False

Not True is False

Not False is True

there is an order of precedence or order of operations for boolean operators. The order is as follows:

not is evaluated first;
and is evaluated next;
or is evaluated last.