#POPCORN HACK 1
vA = True # CHANGEABLE
def check_if_true(value):
if value:
print("vA is true!")
else:
print("vA is false!")
check_if_true(vA)
vA is true!
#POPCORN HACK 1
vA = True # CHANGEABLE
vB = False # CHANGEABLE
def check_both_or_either(value1, value2):
if value1 and value2:
print("Both vA and vB are true!")
elif value1 or value2:
print("At least one of vA or vB is true!")
else:
print("Both vA and vB are false.")
check_both_or_either(vA, vB)
At least one of vA or vB is true!
#POPCORN HACK 2
number = 15 # CHANGEABLE
is_greater_than_10 = number > 10
if is_greater_than_10:
print(f"The number {number} is greater than 10.")
else:
print(f"The number {number} is not greater than 10.")
The number 15 is greater than 10.
#POPCORN HACK 3
number = 345 # CHANGEABLE
is_three_digits = 100 <= number <= 999
if is_three_digits:
print(f"The number {number} is a three-digit number.")
else:
print(f"The number {number} is not a three-digit number.")
The number 345 is a three-digit number.
#HOMEWORK HACK (I think I did this right)
values = [True, False]
print(" A B A AND B A OR B NOT A")
print("--------------------------------------------")
for A in values:
for B in values:
A_and_B = A and B
A_or_B = A or B
not_A = not A
print(f"{A:<7} {B:<7} {A_and_B:<10} {A_or_B:<10} {not_A:<7}")
A B A AND B A OR B NOT A
--------------------------------------------
1 1 1 1 0
1 0 0 1 0
0 1 0 1 1
0 0 0 0 1