IF
Logical AND
Logical OR
Logical NOT
What prints?
100

What keyword starts a conditional statement in Python?

if

100

When using the logical AND operator, how many conditions must be True for the entire statement to be True?

Both must be TRUE

100

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

100

What does the logical NOT operator do?

Reverses the value. T to F. F to T.

100

What will print? `x = 5; if x > 3: print('Yes') else: print('No')`

Yes

200

What will this code print? `age = 16; if age >= 16: print('Drive')`

Drive

200

What will print? `age = 17; if age >= 16 and age < 18: print('Teen') else: print('Other')`

Teen

200

What will print? `day = 'Saturday'; if day == 'Saturday' or day == 'Sunday': print('Weekend') else: print('Weekday')`

Weekend

200

What will print? `raining = False; if not raining: print('Play outside') else: print('Stay inside')`

Play outside

200

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.

300

What symbol is used to check whether two values are equal in Python?

==

300

What will print? `score = 90; if score >= 80 and score < 90: print('A') else: print('Not A')`

Not A

300

What will print? `score = 60; if score >= 90 or score >= 70: print('Pass') else: print('Fail')`

Fail

300

If `is_ready = True`, what is the value of `not is_ready`?

False

300

What will print? `x = 2; if x == 1 or x == 2: print('Correct') else: print('Wrong')`

Correct

400

What will this code print? `score = 75; if score >= 70: print('Pass')`

Pass

400

What will print? `money = 20; if money >= 10 and money <= 25: print('Enough') else: print('Not enough')`

Enough

400

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

400

What will print? `logged_in = False; if not logged_in: print('Please log in') else: print('Welcome')`

Please log in

400

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.

500

What will this code print? `temperature = 50; if temperature > 80: print('Hot')`

Nothing - because 50 is not greater than 80.

500

What will print? `age = 15; has_id = True; if age >= 16 and has_id: print('Allowed') else: print('Not allowed')`

Not allowed

500

What will print? `number = 12; if number < 10 or number > 20: print('Outside') else: print('Inside')`

Inside - both conditions are FALSE

500

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.

500

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.