I understand that booleans compare statements for values.
“and” checks if both statements are true
“or” checks if one of them is atleast true
“not” gives the opposite of a statement
not is evaluated first, and is evaluated next, or is evaluated last.
When it comes to solving these exercises, i cant seem to fully remember what each operator does and which seems to come first or last, is there any method to help me remember these easier? It gets quite confusing when it goes " not not and" or " false and not true"
and expression that has
False in it is
or expression that has
True in it is
not negates it.
Try it out in your Terminal for practice.
>>> True and not False
>>> False and True
>>> False or True
>>> not not False and True
>>> not True or not not False
Thanks! just one question about the not operator.
i understand that the “not true” is negated, which means it cannot be true. However, the “not not false” i’m not sure if im correct. “not not” cancel eachother out meaning it is true that it is false? or am i misunderstanding?
not negates whatever the value is.
(I’m using my terminal on my mac, in Python3):
>>> not False #True
>>> not not False #not(True)
>>> not True #False
>>> not not True #not(False)
My advice is practice until you solidly understand it.