logo

AQA A-Level Computer Science practice

How many times is the body of this Python 3 loop executed? for count in range(4): print(count)

Try the question first, then check the answer and practise the same topic again.

At a glance

MCQ

Type

practice

Style

Topic

Programming

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).

  1. A.3
  2. B.4
  3. C.5
  4. 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.

Related flashcards

No flashcards are published for this page yet.

Related practice questions