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
Model answer
What a good answer should say
- 4
Explanation
Why this works
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.
Common mistake
No common mistake is linked to this question yet.
