← Quiz: Python Loops: all 13 questions
Quiz: Python Loops · Question 5 of 13
When does the else block of a for loop run?
When does the else block of a for loop run?
- A.Every time
- B.Only when the loop body never runs
- C.When the loop ends without hitting break
- D.Only after a break
Answer & explanation
Correct answer: When the loop ends without hitting break
Loop-else runs if the loop completes normally, without break.
Can you get the rest right without peeking?
Take the timed Quiz: Python Loops quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →