What keyword starts a conditional statement in Python?
if
When using the logical AND operator, how many conditions must be True for the entire statement to be True?
Both must be TRUE
When using the logical OR operator, how many conditions must be True for the entire statement to be True?
At least ONE must be TRUE
What does the logical NOT operator do?
Reverses the value. T to F. F to T.
What will print? `x = 5; if x > 3: print('Yes') else: print('No')`
Yes
What will this code print? `age = 16; if age >= 16: print('Drive')`
Drive
What will print? `age = 17; if age >= 16 and age < 18: print('Teen') else: print('Other')`
Teen
What will print? `day = 'Saturday'; if day == 'Saturday' or day == 'Sunday': print('Weekend') else: print('Weekday')`
Weekend
What will print? `raining = False; if not raining: print('Play outside') else: print('Stay inside')`
Play outside
What will print? `x = 5; if x > 3 and x < 5: print('A') else: print('B')`
B. The second condition is False because 5 is not less than 5.
What symbol is used to check whether two values are equal in Python?
==
What will print? `score = 90; if score >= 80 and score < 90: print('A') else: print('Not A')`
Not A
What will print? `score = 60; if score >= 90 or score >= 70: print('Pass') else: print('Fail')`
Fail
If `is_ready = True`, what is the value of `not is_ready`?
False
What will print? `x = 2; if x == 1 or x == 2: print('Correct') else: print('Wrong')`
Correct
What will this code print? `score = 75; if score >= 70: print('Pass')`
Pass
What will print? `money = 20; if money >= 10 and money <= 25: print('Enough') else: print('Not enough')`
Enough
What will print? `age = 15; has_permission = True; if age >= 16 or has_permission: print('Allowed') else: print('Not allowed')`
Allowed - the second condition is true
What will print? `logged_in = False; if not logged_in: print('Please log in') else: print('Welcome')`
Please log in
What will print? `x = 7; if x > 5 and not x > 10: print('A') else: print('B')`
A. Both conditions are True: 7 is greater than 5, and `not (7 > 10)` is True.
What will this code print? `temperature = 50; if temperature > 80: print('Hot')`
Nothing - because 50 is not greater than 80.
What will print? `age = 15; has_id = True; if age >= 16 and has_id: print('Allowed') else: print('Not allowed')`
Not allowed
What will print? `number = 12; if number < 10 or number > 20: print('Outside') else: print('Inside')`
Inside - both conditions are FALSE
What will print? `number = 8; if not number > 10: print('A') else: print('B')`
A. The expression `number > 10` is False, and `not False` becomes True.
What will print? `age = 17; has_ticket = False; if (age >= 18 or has_ticket) and not age < 13: print('Enter') else: print('Stay out')`
Both AND and OR are false. Therefore, else prints.