← VCE Software Development U3O1

Turning pseudocode into Python

Pseudocode steps map to Python lines: <- becomes =, input becomes input(), if becomes if with a colon, for becomes for in range(). END IF becomes un-indenting.

Understanding Turning pseudocode into Python in VCE Software Development U3O1

What it does: IF becomes lowercase if, THEN is replaced by a colon, and the next lines are indented. FOR becomes for ... in range(). The end number in range() is not included, so 1 TO 5 needs range(1, 6). The pseudocode arrow <- becomes a single = in Python. It means 'store this value in the variable'. Python has no THEN. Instead you finish the if line with a colon (:). range() stops BEFORE the end number, so to count 1 to 5 you write range(1, 6). Don't forget the colon. Python has no END IF. The indented lines belong to the if, and the block ends when you go back to the left margin.

Common mistakes: The pseudocode arrow <- becomes = in Python. The line should be name = input('Name: '). Python does not use the pseudocode arrow <-. Assignment uses =, so the line should be score = 0.

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 72–96) and word search (Modules 72–113).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which Python line matches the pseudocode: score <- 0
score <- 0score = 0
Matches
score <- 0
↓
The pseudocode arrow <- was copied into Python. Python needs = instead: score = 0
Applying
Meanings
Term
score <- 0 becomes score = 0
Meaning
Pseudocode steps map to Python lines: <- becomes =, input becomes input(), if becomes if with a colon, for becomes for in range(). END IF becomes un-indenting.
Practice
score = 0
Testing
Gaps
score 0
Check Answer
Spots
1score = 0
2name <- input('Name: ')

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

The 'Platinum Fox' badge — Tundra Legend, 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 line matches the pseudocode: score <- 0
A. score = 0 ✓
B. score <- 0
The pseudocode arrow <- becomes a single = in Python. It means 'store this value in the variable'.
2. Which Python line matches the pseudocode: INPUT name
A. name = input() ✓
B. input name
INPUT becomes the input() function. You store what the user types in a variable, like name = input().
3. Which Python line matches the pseudocode: IF score > 10 THEN
A. if score > 10 then
B. if score > 10: ✓
Python has no THEN. Instead you finish the if line with a colon (:).
4. Which Python line matches the pseudocode: FOR i <- 1 TO 5
A. for i in range(1, 5):
B. for i in range(1, 6): ✓
range() stops BEFORE the end number, so to count 1 to 5 you write range(1, 6). Don't forget the colon.
5. How does Python show END IF from your pseudocode?
A. By un-indenting the next line ✓
B. By typing end if
Python has no END IF. The indented lines belong to the if, and the block ends when you go back to the left margin.

Match the Pairs

score <- 0 → Pseudocode assignment arrow: in Python it becomes score = 0
name = input("Name? ") → Python version of the pseudocode step INPUT name
Pseudocode IF score > 5 THEN becomes an if line ending with a colon → if score > 5:
Pseudocode FOR i <- 1 TO 5 becomes a for loop with range(1, 6) → for i in range(1, 6):
score <- 0 → The pseudocode arrow <- was copied into Python. Python needs = instead: score = 0
if age >= 13 print("Teen") → The if line is missing its colon, and the print line is not indented. END IF is shown by un-indenting, not by a keyword.

Key Term

score <- 0 becomes score = 0
Pseudocode steps map to Python lines: <- becomes =, input becomes input(), if becomes if with a colon, for becomes for in range(). END IF becomes un-indenting.

Fill in the Blanks

1. score = 0
Hint: Type the Python symbol that replaces the pseudocode assignment arrow
2. name = input("Your name? ")
Hint: Type the function that replaces the pseudocode step for asking the user
3. if score >= 10: print("You win!")
Hint: Type the keyword that starts a decision, matching the pseudocode IF
4. for i in range(1, 6): print(i)
Hint: Type the function that makes the sequence of numbers for the loop
5. if age >= 12 and age <= 15: print("Teen")
Hint: Type the Python keyword that replaces the pseudocode AND in the condition

Spot the Error

Question 1
A score = 0
B name <- input('Name: ')
C print(name)
Line B — The pseudocode arrow <- becomes = in Python. The line should be name = input('Name: ').
Question 2
A score <- 0
B if score > 5:
C print('Win')
Line A — Python does not use the pseudocode arrow <-. Assignment uses =, so the line should be score = 0.
Question 3
A for i in range(5)
B print(i)
C print('Done')
Line A — A Python for loop header must end with a colon. It should be for i in range(5):.
Question 4
A age = int(input('Age: '))
B if age => 13:
C print('Teen')
Line B — The pseudocode 'greater than or equal to' becomes >= in Python. => is not a valid operator, so it should be if age >= 13:.
Question 5
A total = 0
B for n range(1, 4):
C total = total + n
D print(total)
Line B — A Python for loop needs the keyword in before range(). It should be for n in range(1, 4):.

Student with a class code? Join your class →