Bool problems

why is bool_three and bool_five False?

bool_one = 2 ** 3 == 108 % 100 or ‘Cleese’ == ‘King Arthur’
print bool_one
#this will be True
bool_two = True or False
print bool_two
#this will be True
bool_three = 100 ** 0.5 >= 50 or False
print bool_three
#this will be True
bool_four = True or True
print bool_four
#this will be True
bool_five = 1 ** 100 == 100 ** 1 or 3 * 2 * 1 != 3 + 2 + 1
print bool_five
#this will be True

The above or has two operands in an OR expression.

Consider:

True or False   =>  True

False or False  =>  False

and,

0 or 1          =>  1

1 or 0          =>  1

Now,

100 ** 0.5      =>  10

10 >= 50        =>  False

so,

False or False  =>  False

#5

1 ** 100 == 100 ** 1 or 3 * 2 * 1 != 3 + 2 + 1

1 ** 100        =>  1
100 ** 1        =>  100

so,

1 == 100        =>  False

and,

3 * 2 * 1 != 3 + 2 + 1

6 != 6          =>  False

thus,

False or False  =>  False

omg apparently I don’t know math today lol

Thanks
:sweat_smile:

1 Like