Knowledge check

Python for Beginners: Build Practical Software Skills with Hospital-Themed Projects
Lesson Content
0% Complete

Q1. Why are loops useful in programming?

  • They make code longer
  • They repeat actions automatically
  • They remove the need for logic
  • They only work with numbers
Reveal answer

Answer: They repeat actions automatically
Loops help automate repeated work, which saves time and reduces duplication.


Q2. True or False: A while loop should have a clear condition that eventually becomes false.

  • True
  • False
Reveal answer

Answer: True
If the condition never changes, the loop may run forever.


Q3. Which loop is often used to move through a list of items?

  • for loop
  • if statement
  • print statement
  • input statement
Reveal answer

Answer: for loop
for loops are commonly used to repeat actions over each item in a sequence.