is_teenager = True likes_pizza = False print(is_teenager) # This will print: True print(likes_pizza) # This will print: False
True False
age = 15 print(age == 15) # True, because age is indeed 15 print(age > 20) # False, because age is not greater than 20 print(age != 10) # True, because age is not equal to 10
True False True
age = 15 has_permission = True # Check if someone is a teenager and has permission is_allowed = age >= 13 and age <= 19 and has_permission print(is_allowed) # True # Check if someone is either a teenager or has permission might_be_allowed = age >= 13 or has_permission print(might_be_allowed) # True # Using not to invert a Boolean value print(not has_permission) # False, because has_permission is True
True True False
age = 15 if age >= 13 and age <= 19: print("You're a teenager!") else: print("You're not a teenager.")
You're a teenager!