← ACARA Digital Technologies Years 7–8

Scratch repeat block as a for loop

Python's version of the Scratch repeat 10 block. The lines indented under it run 10 times, and i counts from 0 to 9.

Understanding Scratch repeat block as a for loop in ACARA Digital Technologies Years 7–8

What it does: The number in repeat 4 goes inside range(4), and the block inside the repeat becomes a line indented under the for line. Python uses indentation, usually 4 spaces, to show which lines belong to the loop. The line must end with a colon. Without it Python gives a SyntaxError. Counting starts at 0, so i goes up to 9. The loop still runs 10 times. i counts from 0 to 9, which is 10 values, so the print line runs 10 times.

Common mistakes: The string is missing its closing quote. The line inside the loop should be ' print("Step")'. The for line must end with a colon. It should be 'for i in range(10):'.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 482–519) and word search (Modules 420–519).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which Python code does the same job as the Scratch block 'repeat 10'?
repeat 10:for i in range(10):
Matches
for i in range(10) print("Hi")
↓
The colon is missing at the end of the for line, so Python gives a syntax error. It should be for i in range(10):
Applying
Meanings
Term
for i in range(10):
Meaning
Python's version of the Scratch repeat 10 block. The lines indented under it run 10 times, and i counts from 0 to 9.
Practice
for i in range(10):
Testing
Gaps
for i in (10):
Check Answer
Spots
2for i in range(10):
3 print("Step)

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Rhinoceros' badge — Thick-Skinned Coder, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which Python code does the same job as the Scratch block 'repeat 10'?
A. for i in range(10): ✓
B. repeat 10:
Python has no repeat keyword. A for loop with range(10) runs the lines under it 10 times.
2. In a Scratch 'repeat 10' block, the blocks inside the C-shape are the ones that repeat. How does Python show which lines are inside the loop?
A. They are indented underneath the for line ✓
B. They are wrapped in curly brackets { }
Python uses indentation, usually 4 spaces, to show which lines belong to the loop.
3. Which for loop line has the correct syntax?
A. for i in range(10)
B. for i in range(10): ✓
The line must end with a colon. Without it Python gives a SyntaxError.
4. What values does i take in for i in range(10):?
A. 1, 2, 3, ... 10
B. 0, 1, 2, ... 9 ✓
Counting starts at 0, so i goes up to 9. The loop still runs 10 times.
5. How many times does this code print Hi? for i in range(10): print('Hi')
A. 10 times ✓
B. 9 times
i counts from 0 to 9, which is 10 values, so the print line runs 10 times.

Match the Pairs

for i in range(10): → Python's version of the Scratch repeat 10 block: it repeats the indented lines 10 times
for i in range(5): print(i) → Prints 0, 1, 2, 3, 4 because the counter i starts at 0 and the loop runs 5 times
A Scratch repeat 4 block with a move block inside it becomes a for loop with the move line indented underneath → for i in range(4): print("move")
A Scratch repeat 3 block with two blocks inside it becomes a for loop with both lines indented the same amount → for i in range(3): print("jump") print("spin")
for i in range(10) print("Hi") → The colon is missing at the end of the for line, so Python gives a syntax error. It should be for i in range(10):
for i in range(10): print("Hi") → The print line is not indented, so Python does not know it is inside the loop. It should be indented 4 spaces.

Key Term

for i in range(10):
Python's version of the Scratch repeat 10 block. The lines indented under it run 10 times, and i counts from 0 to 9.

Fill in the Blanks

1. for i in range(10): print("Jump")
Hint: Type the built-in function name that makes the sequence of numbers to loop over.
2. # Scratch: repeat 10 for i in range(10): print("Clap")
Hint: Type the number of repeats that matches the Scratch repeat block in the comment.
3. for i in range(5): print("Step")
Hint: Type the keyword that starts a Python loop which repeats a set number of times.
4. for i in range(3): print(i)
Hint: Type the loop variable name that holds the current count.
5. for i in range(3): print(i + 1)
Hint: Counting starts at 0, so type the number to add to show the count starting from one.

Spot the Error

Question 1
A print("Start")
B for i in range(10):
C print("Step)
Line C — The string is missing its closing quote. The line inside the loop should be ' print("Step")'.
Question 2
A count = 0
B for i in range(10)
C count = count + 1
Line B — The for line must end with a colon. It should be 'for i in range(10):'.
Question 3
A for i in range[10]:
B print("Jump")
C print("Done")
Line A — range uses round brackets, not square brackets. It should be 'for i in range(10):'.
Question 4
A print("Dance time")
B For i in range(10):
C print("Spin")
Line B — Python is case sensitive, so 'for' must be lowercase. It should be 'for i in range(10):'.
Question 5
A for i in range(10):
B print("Move")
C print("Turn")
D Print("Finished")
Line D — print must be written in lowercase. 'Print' causes a NameError. It should be 'print("Finished")'.

Student with a class code? Join your class →