🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.Every time
  2. B.Only when the loop body never runs
  3. C.When the loop ends without hitting break
  4. 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 →