🎙 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 3 of 13

What does this print? (code)

What does this print?

i = 0
while i < 5:
    i += 2
print(i)
  1. A.4
  2. B.5
  3. C.6
  4. D.2
Answer & explanation

Correct answer: 6

i goes 0 → 2 → 4 → 6. At 6 the condition fails and the loop ends.

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 →