9/15 bool_one & bool_five


#1

The answers for both of these are supposed to be true, but isn't it suppose to be false?

bool_one equal to the result of False or not True and True:

Breaking it down:

First, not True == False
Then, False and True == False
Finally, False or False == False (final)

bool_five equal to the result of False or not (True and True):

Breaking it down:
First, (True and True) == True
Then, not True == False
Finally, False or False == False (final)

Can someone break down how bool_one and five can result in true?


#2

@coreslayer68930,
Given the order of evaluation:

01. not is evaluated first;
02. and is evaluated next;
03. or is evaluated last.

    given: False or not True and True
bool_one = False or ( (not True) and True ) <<==Translation evaluation-Order
       (1) False or (   False    and True )
       (2) False or          False
    Result      False

      given: False and not True or True
bool_two = ( False and (not True) ) or True
       (1) ( False and   False    ) or True
       (2)           False          or True
    Result                         True

      given: True and not (False or False)
bool_three = True and ( not (False or False) )
        (1)  True and ( not         False    )
        (2)  True and        True
     Result       True

          given: not not True or False and not True
bool_four   =  ( not ( not True) ) or ( False and ( not True ) )
        (1)    ( not     False   ) or ( False and    False     )
        (2)    (       True      ) or (      False             )
     Result                       True

       given: False or not (True and True)
bool_five   = False or ( not (True and True) )
        (1)   False or ( not       True      )
        (2)   False or (       False         )
   Result          False

=================================


=======================
  AND  | true  | false
 ------|-------|-------
 true  | true  | false
 ------|-------|-------
 false | false | false
 ------|-------|-------

=======================
 !(AND)| true  | false
 ------|-------|-------
 true  | false | true
 ------|-------|-------
 false | true  | true
 ------|-------|-------

=======================
  OR   | true  | false
 ------|-------|-------
 true  | true  | true
 ------|-------|-------
 false | true  | false
 ------|-------|-------

=======================
 !(OR) | true  | false
 ------|-------|-------
 true  | false | false
 ------|-------|-------
 false | false | true
 ------|-------|-------

#3

Hi @coreslayer68930,

A very valid question on something that could temporarily be confusing to learners. Yet, I hope the following baby-trick could be of any help:

-When you mix truth with falsehood in a case, you're lying anyway. Hence, True and False == False
-When you have a choice between truth or falsehood in any case, you know that the truth holds more power in the end. Hence True or False == True

Just keeping it fun :smile:


#4

Hm, so I actually got false for Bool_One and Five as well, but the console told me I was wrong, and it was True....