New
New
Year 10
AQA

For loops

I can use iteration controlled by a count value to repeat sequences of code.

New
New
Year 10
AQA

For loops

I can use iteration controlled by a count value to repeat sequences of code.

These resources will be removed by end of Summer Term 2025.

Switch to our new teaching resources now - designed by teachers and leading subject experts, and tested in classrooms.

These resources were created for remote use during the pandemic and are not designed for classroom teaching.

Lesson details

Key learning points

  1. Iteration can be controlled by a count value that determines the amount of times instructions should be repeated.
  2. For loops are used in Python to implement count-controlled iteration.

Keywords

  • Iteration - the process of repeating a sequence of instructions within a program loop

  • For loops - an iterative statement that will repeat for the length of a given sequence

Common misconception

Learners may think a for loop will always repeat forever unless they manually stop it.

A for loop repeats a set number of times, based on the range or count value given. The loop ends automatically when the final value in the range has been reached.


To help you plan your year 10 computer science lesson on: For loops, download all teaching resources for free and adapt to suit your pupils' needs...

Encourage students to predict what a for loop will output before running the code. This helps them reason through how iteration works and improves debugging skills.
Teacher tip

Equipment

Code in this lesson is made using Python. Code examples use the RPF Code Editor but any Python IDE is suitable.

Licence

This content is © Oak National Academy Limited (2025), licensed on Open Government Licence version 3.0 except where otherwise stated. See Oak's terms & conditions (Collection 2).

Lesson video

Loading...

6 Questions

Q1.
What is the purpose of a trace table in programming?
to compile a program
to write pseudocode
to design a user interface
Correct answer: to debug and track variable values
Q2.
What does a condition in a program control?
Correct answer: the flow of execution
the memory usage
the program's speed
the input format
Q3.
Which of these is an example of a condition?
print(x)
Correct answer: `x > 10`
x + 10
int x = 10
Q4.
Write a condition-controlled loop that runs as long as the variable
num
is less than or equal to 10.
Correct Answer: while num <= 10:, while num<=10:
Q5.
Match the terms to their definitions:
Correct Answer:trace table,tracks variable values step by step

tracks variable values step by step

Correct Answer:condition,logical expression controlling program flow

logical expression controlling program flow

Correct Answer:while loop,repeats code until a condition is False

repeats code until a condition is False

Q6.
What is the role of iteration in programming?
storing variables
debugging errors
Correct answer: repeating code
optimising memory

6 Questions

Q1.
What does a for loop use to control iteration?
a function call
a string
Correct answer: a count value
a condition
Q2.
What happens if a for loop's range is set to range(5)?
It repeats four times.
Correct answer: It repeats five times.
It repeats six times.
It repeats indefinitely.
Q3.
What ensures a for loop stops execution?
Correct answer: reaching the end of the range
a manual stop command
a break statement
infinite conditions
Q4.
Which of these is an example of iteration?
print("Hello")
x = 10
if x > 5:
Correct answer: `for i in range(3):`
Q5.
What is the starting value of the variable in
for i in range(4)
?
Correct Answer: 0, zero
Q6.
Write the Python code to create a for loop that iterates a variable called
count
from 3 to 7.
Correct Answer: for count in range(3, 8):