Bird
0
0

Why does the continue statement not affect the loop variable increment in a for loop?

hard📝 Conceptual Q10 of 15
Python - Loop Control
Why does the continue statement not affect the loop variable increment in a for loop?
ABecause continue manually increments the loop variable.
BBecause the loop variable is automatically updated by the loop control, independent of continue.
CBecause continue pauses the loop variable increment until next iteration.
DBecause continue resets the loop variable to zero.
Step-by-Step Solution
Solution:
  1. Step 1: Understand for loop variable behavior

    In a for loop, the loop variable is set by the loop control mechanism automatically each iteration.
  2. Step 2: Effect of continue on loop variable

    Continue skips the rest of the iteration but the loop control still updates the variable for the next iteration.
  3. Final Answer:

    Because the loop variable is automatically updated by the loop control, independent of continue. -> Option B
  4. Quick Check:

    Loop variable update is automatic, continue does not change it [OK]
Quick Trick: For loops control variable update automatically, continue skips code only [OK]
Common Mistakes:
MISTAKES
  • Thinking continue changes loop variable
  • Assuming continue resets or pauses variable
  • Confusing continue with break effects

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes