Recall & Review
beginner
What is the purpose of indentation in Python?
Indentation in Python shows which lines of code belong together in a block. It helps the computer understand the structure and flow of the program.
Click to reveal answer
beginner
How many spaces are recommended for each indentation level in Python?
The recommended number of spaces for each indentation level is 4 spaces. This keeps code clear and consistent.
Click to reveal answer
intermediate
What happens if you mix tabs and spaces in Python indentation?
Mixing tabs and spaces can cause errors or unexpected behavior because Python treats them differently. It's best to use only spaces or only tabs consistently.
Click to reveal answer
beginner
Which Python keywords introduce a new block that requires indentation?
Keywords like if, for, while, def, and class start new blocks that must be indented.Click to reveal answer
beginner
What error do you get if indentation is incorrect in Python?
Python raises an IndentationError when the indentation is wrong or inconsistent.
Click to reveal answer
What does indentation in Python indicate?
✗ Incorrect
Indentation shows which lines of code are grouped together in a block.
Which of these keywords starts a new indented block in Python?
✗ Incorrect
The 'if' keyword starts a new block that requires indentation.
What is the recommended number of spaces for one indentation level?
✗ Incorrect
Python style guides recommend 4 spaces per indentation level.
What error occurs if indentation is inconsistent?
✗ Incorrect
Python raises an IndentationError when indentation is wrong.
Why should you avoid mixing tabs and spaces?
✗ Incorrect
Mixing tabs and spaces can cause errors because Python treats them differently.
Explain why indentation is important in Python and how it affects the program flow.
Think about how Python knows which lines belong together.
You got /4 concepts.
Describe the best practices for indentation in Python.
Consider style and avoiding errors.
You got /4 concepts.