← IGCSE Computer Science Paper 2

Pseudocode assignment, INPUT and OUTPUT in Python

Python for INPUT Age: = replaces the arrow, input() reads text, and int() turns that text into a whole number. OUTPUT Age becomes print(Age); use float() for decimals.

Understanding Pseudocode assignment, INPUT and OUTPUT in Python in IGCSE Computer Science Paper 2

What it does: In Python, = is the assignment operator, so it replaces the pseudocode arrow ←. input() returns text, so float() converts it into a decimal number. INPUT Price would only store text without it. INPUT Name becomes Name = input(). The value typed in is stored in the variable on the left of the =. OUTPUT becomes print() in Python. The value to show goes inside the brackets. Both Pascal case and Python style names are valid in Python. Just use the same spelling every time in your program.

Common mistakes: input is a function, so it needs brackets to be called. INPUT Age becomes Age = int(input()), with input() ending in (). The arrow ← is pseudocode only. Python uses = for assignment, so the line should be Total = Count * 2.

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 188–213) and word search (Modules 188–231).

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 ← 10
Score = 10Score ← 10
Matches
Age = input() Next = Age + 1
↓
Age is still text because int() was not used, so adding 1 to it causes an error. It should be Age = int(input()).
Applying
Meanings
Term
Age = int(input())
Meaning
Python for INPUT Age: = replaces the arrow, input() reads text, and int() turns that text into a whole number. OUTPUT Age becomes print(Age); use float() for decimals.
Practice
Age = int(input())
Testing
Gaps
Name = ()
Check Answer
Spots
1Name = input()
2Age = int(input)

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

The 'Warthog' badge — Definition Digger, 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 ← 10
A. Score = 10 ✓
B. Score ← 10
Python has no arrow. The assignment arrow ← becomes a single equals sign =.
2. Which Python line matches the pseudocode: INPUT Name
A. Name = input() ✓
B. input Name
INPUT Name becomes Name = input(). The value typed in is stored in the variable on the left of the =.
3. Which Python line matches the pseudocode: OUTPUT Total
A. print(Total) ✓
B. output(Total)
OUTPUT becomes print() in Python. The value to show goes inside the brackets.
4. The pseudocode is INPUT Age and Age will be used in a sum. Which Python line is better?
A. Age = input()
B. Age = int(input()) ✓
input() always returns text. Wrap it in int() to get a whole number you can do arithmetic with.
5. The pseudocode is INPUT Price where Price can be 2.50. Which Python line is better?
A. Price = int(input())
B. Price = float(input()) ✓
int() only handles whole numbers, so typing 2.50 would cause an error. Use float() for decimals.

Match the Pairs

Age = int(input()) → Python for INPUT Age: reads what the user types and turns the text into a whole number
print(Name, Score) → Python for OUTPUT Name, Score: shows both values on one line
Python has no ← arrow, so the pseudocode Total ← 0 is written with a plain = sign → Total = 0
To read a decimal number such as a price, wrap input() in float() so the text becomes a real number → Price = float(input())
Age = input() Next = Age + 1 → Age is still text because int() was not used, so adding 1 to it causes an error. It should be Age = int(input()).
Total ← 5 OUTPUT Total → Pseudocode was left unchanged: Python needs Total = 5 and print(Total) instead of the arrow and OUTPUT.

Key Term

Age = int(input())
Python for INPUT Age: = replaces the arrow, input() reads text, and int() turns that text into a whole number. OUTPUT Age becomes print(Age); use float() for decimals.

Fill in the Blanks

1. Name = input()
Hint: Type the function that reads text typed by the user.
2. Age = int(input())
Hint: Type the function that turns the text into a whole number.
3. Price = float(input())
Hint: Type the function that turns the text into a decimal number.
4. Total = 7 + 3 print("Total:", Total)
Hint: Type the function that replaces OUTPUT and shows values on screen.
5. Score = int(input())
Hint: Type the Python symbol that replaces the pseudocode assignment arrow.

Spot the Error

Question 1
A Name = input()
B Age = int(input)
C print(Name, Age)
Line B — input is a function, so it needs brackets to be called. INPUT Age becomes Age = int(input()), with input() ending in ().
Question 2
A Count = int(input())
B Total ← Count * 2
C print(Total)
Line B — The arrow ← is pseudocode only. Python uses = for assignment, so the line should be Total = Count * 2.
Question 3
A Name = input()
B Score = int(input())
C Bonus = 5
D print(Name + Score + Bonus)
Line D — Name is text and Score is a number, so + cannot join them and gives a TypeError. Separate the values with commas: print(Name, Score + Bonus).
Question 4
A Length = float(input())
B Width = input()
C Area = Length * Width
D print(Area)
Line B — input() returns text, so multiplying Length by Width causes an error. A number must be read with float(input()).
Question 5
A Age == int(input())
B Next = Age + 1
C print(Next)
Line A — A double == compares values, it does not assign. Use a single = to store the input in Age: Age = int(input()).

Student with a class code? Join your class →