Conditional Basics
Comparison Operators
Nested Logic
Real-World Scenarios
100

What keyword starts a conditional statement in Python?

if

100

Name two comparison operators used in Python (besides ==).

>, < (also >=, <=, !=)

100

What does "nested" mean in "nested if statements"?

Placing one conditional statement inside another.

100

Give one example (in plain English) of a real-life decision that can be modeled with an if statement.

If it's raining, take an umbrella; otherwise, don't.

200

Write the line that checks whether a variable score is equal to 10. (Show only the conditional expression line.)

if score == 10:

200

Which operator checks if one value is not equal to another?

!=

200

True or False: 

You can put an if statement inside another if statement.

True

200

Write a conditional that prints "Free shipping" if total_price is greater than or equal to 50. (Show only the conditional and print line.)

if total_price>=50:    

   print("Freeshipping")

300

Explain in one sentence the difference between if and else

if runs when a condition is true; else runs when that condition is false.

300

True or False: 

The expression 5 <= 5 evaluates to True.

True

300

Given 

a = 10, b = 7, what will this print? 

if a > 5: if b > 5: print("Both") 

else: print("Only a")

Prints "Both"

300

Create a short 3-line code example that checks a temperature variable and prints "Cold" if below 10, "Warm" if between 10 and 25 inclusive, and "Hot" otherwise.

if temperature<10:    

   print("Cold") 

elif temperature<=25:    

   print("Warm") 

else:    

   print("Hot")

400

Given x = 5, what does the following code print? if x > 3: print("A") else: print("B")

print A

400

What does the expression a != b mean in plain English?

"a is not equal to b"

400

Rewrite this nested conditional as a single-level conditional using and: check if x is positive and y is positive, then print "Both positive".

if x>0 and y>0:    

 print("Bothpositive")

400

Describe how you could use if/elif/else to assign letter grades (A, B, C, D, F) based on a numeric score. List the general numeric ranges you would use (no code needed).

Example ranges: 

A: 90–100, 

B: 80–89, 

C: 70–79, 

D: 60–69, 

F: 0–59.

500

Write a short Python code snippet (2–3 lines) that uses if, elif, and else to print "low" if variable n is less than 10, "medium" if n equals 10, and "high" otherwise.

if n<10:    

 print("low") 

elif n==10:    

 print("medium") 

else:    

 print("high")

500

Write a conditional that checks whether age is between 13 and 19 inclusive using comparison operators and logical connectors.

if age>=13 and age<=19:

500

 Explain one reason you might prefer elif over multiple nested if statements.

elif avoids unnecessary checks and makes logic clearer when choices are mutually exclusive.

500

A bookstore gives a 20% discount if a customer buys more than 3 books, else no discount. Write the conditional expression (single if/else block) that prints "Discount" or "No discount" based on variable books_bought.

if books_bought>3: 

   print("Discount")

 else:    

   print("Nodiscount")