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
Answer and explanation
Concise answer
2
Why this is correct
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.
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.
