Exam-style question
Try this first
How many times is the indented statement executed? number = 1 while number < 4: number = number * 2.
- A.1
- B.2
- C.3
- D.The loop never ends
Model answer
What a good answer should say
- 2
Explanation
Why this works
The loop starts with number equal to 1. The first iteration changes it to 2, and the second changes it to 4.
The condition is then false, so the loop stops.
Common mistake
No common mistake is linked to this question yet.
