Python_Institute
PCEP-30-02 · Question #305
How many stars will the following code print to the monitor? i = 0 while i < i + 2: i += 1 print('') else: print('')
The correct answer is C. The snippet will enter an infinite loop. See the full explanation below for the reasoning.
Question
How many stars will the following code print to the monitor?
i = 0
while i < i + 2:
i += 1
print('')
else:
print('')
Options
- Atwo
- Bone
- CThe snippet will enter an infinite loop.
- Dzero
How the community answered
(52 responses)- A6% (3)
- B4% (2)
- C79% (41)
- D12% (6)
Community Discussion
No community discussion yet for this question.