Scratch if and if-else blocks as Python if/else
Python's version of Scratch's if block: the hexagon condition becomes a comparison like ==, then a colon, and the blocks inside become indented lines. Add else: for the else part.
Understanding Scratch if and if-else blocks as Python if/else in ACARA Digital Technologies Years 7–8
What it does: The say block inside the if becomes an indented print() line below the if line, so Python knows it belongs to the if. A single = in Python stores a value in a variable, so the Scratch equals check becomes the double equals ==. Python uses indentation, usually 4 spaces, to show which lines are inside the if. It does not use curly brackets. Python needs a colon after else, just like after the if line. The else: lines up with its if, like the bottom 'else' bar of the Scratch block sits at the same level as the 'if' at the top.
Common mistakes: A single = stores a value in a variable. The Scratch = in the hexagon becomes == in Python, so it should be: if score == 10:. A Python if line must end with a colon, which starts the indented block. It should be: if age >= 13:.
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.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
if score == 10:Fill in the Blanks
Spot the Error
Student with a class code? Join your class →