Exam-style question
Try this first
How many times is the body of this Python 3 loop executed? for count in range(4): print(count).
- A.3
- B.4
- C.5
- D.It depends on the value of count before the loop
Answer and explanation
Concise answer
It depends on the value of count before the loop
Why this is correct
The range produces 0, 1, 2 and 3, so the loop body executes four times. This is definite iteration because the number of repetitions is determined by the range.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
