Popcorn Hack 1
variableC = True
variableD = False
if variableD:
print("VariableD is true!")
else:
print("VariableC is false!")
if variableC and not variableD:
print("VariableC is true and Variable D is false")
if variableC or varaibleD:
print("Either variableC or variableD is true")
VariableC is false!
VariableC is true and Variable D is false
Either variableC or variableD is true
Popcorn Hack 2
number = 5
if number > 1:
print("number is greater than one!")
else:
print("number is not greater than one!")
number is greater than one!
Popcorn Hack 3
number = 50
if number >= 10 and number <= 99:
print("number is two digits!")
else:
print("number is not two digits!")
number is two digits!
HW Hack
def deMorganLaw():
print("A B Result")
values = [False, True]
for A in values:
for B in values:
result = not (A and B) == (not A or not B)
print(f"{A} {B} {result}")
deMorganLaw()
A B Result
False False True
False True True
True False True
True True True