Conditions and Controll Flow


#1

I'm taking a quiz. How does this evaluate to true?

not True and False or not False

-----My thinking breakdown----------

not True ---- > This line evaluates to false
and
False or not False -----> not False becomes True, so it's "False or True" which evaluates to True

The statement is then basically "False and True" and since "False and True" evaluates to false. How is this statement true? :0


#2


#3

Basically,
FOR "OR"
a statement is True(1) when either input is True(1) or both are whereas when both are False(0), it outputs False(0)

FOR "AND"
a statement is only True(1) when both inputs are True(1) else in every other case, it's a False (0)

Hope this helps! :slight_smile:


#4

But with that logic doesnt it go:

not True and False or not False
(false)...........................(true)
False and False or True
.....................(True)
False and True
......(False)


#5

For this now, the last statement will result to False.

False and True or not (False or True) will evaluate to
False or False = False


not not (False or True) will be:
not not (True) = True


not(True and not True) or False will be:
not (False) = True


not True and False or not False will be:
False and False or True
False or True = True

Hope this helps! :slight_smile: