Q1. What is the main purpose of an if statement?
- To store text in a variable
- To make a program choose between paths based on a condition
- To delete a file
- To print every line the same way
Reveal answer
Answer: To make a program choose between paths based on a condition
if statements let a program respond differently depending on whether a condition is true or false.
Q2. True or False: Indentation matters in Python.
- True
- False
Reveal answer
Answer: True
Python uses indentation to define code blocks, so it must be consistent.
Q3. Which operator is used to check whether one value is greater than another?
- =
- >
- +
- %
Reveal answer
Answer: >
The greater-than operator compares two values and returns true if the left value is larger.