← Quiz: Python Loops: all 13 questions
Quiz: Python Loops · Question 10 of 13
What does this print? (code)
What does this print?
n = 1
while True:
n *= 2
if n > 20:
break
print(n)
- A.16
- B.20
- C.The loop never ends
- D.32
Answer & explanation
Correct answer: 32
n becomes 2, 4, 8, 16, 32; 32 is the first value above 20, so break stops the loop.
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 →