A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-16.py
1defcount():
2n=0
3whileTrue:
4n+=1
5yieldn
6c=count()
7print(next(c),next(c),next(c))
Iteration
Answer & explanation
Console output
1 2 3
Why
A generator with while True is infinite but lazy: each next() resumes execution until the next yield, then suspends. The three next() calls advance n to 1, 2, and 3 respectively, and the loop never actually runs forever because it is paused between calls.