← Quiz: Python Loops: all 13 questions
Quiz: Python Loops · Question 6 of 13
What does this print? (code)
What does this print?
n = 3
while n:
print(n, end=" ")
n -= 1
- A.3 2 1
- B.3 2 1 0
- C.2 1 0
- D.It runs forever
Answer & explanation
Correct answer: 3 2 1
The loop stops when n becomes 0 (falsy).
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 →