Pseudocode is structured English that describes an algorithm step by step, using programming-style keywords without following the exact rules of any real programming language. At KS3, students use pseudocode to plan algorithms before writing code, making it easier to focus on logic rather than syntax.
Why does pseudocode exist?
When you write in Python, JavaScript or any other programming language, the computer reads your code and executes it exactly — which means a missing colon or an incorrect indentation can stop the whole program. Pseudocode removes that pressure. There is no interpreter checking your spelling; the goal is to express the right logic clearly enough that you or anyone else can translate it into working code.
The DfE national curriculum for computing requires KS3 students to "use logical reasoning to explain how some simple algorithms work and to detect and correct errors in algorithms and programs" (gov.uk/government/publications/national-curriculum-in-england-computing-programmes-of-study). Pseudocode is the main tool for reasoning about algorithms at this level.
At GCSE — where AQA and OCR both include written-paper questions that ask students to read, trace and write pseudocode — the skill developed at KS3 translates directly into exam marks.
What does pseudocode look like?
Unlike a natural language essay, pseudocode uses consistent keywords and indentation to show structure. The most common keywords at KS3:
| Keyword | Meaning |
|---|---|
INPUT |
Accept a value from the user |
OUTPUT / PRINT |
Display a value |
IF … THEN … ELSE … END IF |
Conditional selection |
WHILE … DO … END WHILE |
Condition-checked loop |
FOR … TO … NEXT |
Count-controlled loop |
SET … TO / ← |
Assign a value to a variable |
Different schools and exam boards use slightly different conventions. That is fine — pseudocode is intentionally informal. The important thing is to be consistent within one piece of work.
Pseudocode for the three programming constructs
1. Sequence
Sequence means instructions run one after another, in order. This is the simplest construct.
OUTPUT "Enter your name:"
INPUT name
OUTPUT "Hello, " + name
These three lines run top to bottom, with no branching.
2. Selection (IF statements)
Selection allows the program to choose a path based on a condition.
OUTPUT "Enter your score:"
INPUT score
IF score >= 50 THEN
OUTPUT "Pass"
ELSE
OUTPUT "Fail"
END IF
Indentation shows which lines belong inside the IF block. Most pseudocode styles end selection blocks with END IF so the boundary is clear.
3. Iteration (loops)
Iteration means repeating a set of instructions. There are two common loop types at KS3:
Count-controlled loop (FOR loop) — runs a fixed number of times:
FOR counter FROM 1 TO 5
OUTPUT counter
NEXT counter
This outputs the numbers 1, 2, 3, 4, 5, then stops.
Condition-controlled loop (WHILE loop) — runs until a condition becomes false:
SET total TO 0
WHILE total < 10 DO
OUTPUT "Current total: " + total
SET total TO total + 1
END WHILE
This loop runs until total reaches 10, then stops.
A worked example: number guessing game
Here is a more complete pseudocode program — a simple guessing game:
SET secret TO 42
SET guessed TO FALSE
WHILE guessed = FALSE DO
OUTPUT "Guess a number:"
INPUT guess
IF guess = secret THEN
OUTPUT "Correct! Well done."
SET guessed TO TRUE
ELSE IF guess < secret THEN
OUTPUT "Too low. Try again."
ELSE
OUTPUT "Too high. Try again."
END IF
END WHILE
Tracing through this with guess = 20:
- Is 20 = 42? No
- Is 20 < 42? Yes → output "Too low. Try again."
- Loop continues (guessed is still FALSE)
With guess = 42:
- Is 42 = 42? Yes → output "Correct!" → set guessed to TRUE
- Loop ends (guessed is now TRUE)
This pseudocode uses sequence, selection (IF … ELSE IF … ELSE) and iteration (WHILE) — all three main constructs in one program.
How does pseudocode compare to real Python code?
The pseudocode guessing game above translates almost line for line into Python:
secret = 42
guessed = False
while not guessed:
guess = int(input("Guess a number: "))
if guess == secret:
print("Correct! Well done.")
guessed = True
elif guess < secret:
print("Too low. Try again.")
else:
print("Too high. Try again.")
The logic is identical; only the syntax details change. This is why teachers ask students to write pseudocode first — the thinking is already done before they open a code editor.
Pseudocode vs flowcharts: which should you use?
Both pseudocode and flowcharts represent algorithms, but they suit different tasks:
| Feature | Pseudocode | Flowchart |
|---|---|---|
| Good for visualising flow | Less clear | Very clear |
| Good for complex logic | Very clear | Can get cluttered |
| Closer to real code | Yes | No |
| Shows loops visually | No | Yes (arrows) |
| Exam board preference | AQA, OCR written papers | Both, especially for simpler problems |
BBC Bitesize (bbc.co.uk/bitesize/guides/z6x26yc/revision/1) recommends practising both, as different problems suit different representations. Many KS3 schemes of work use them together: flowchart first, pseudocode second, code third.
Common pseudocode mistakes at KS3
Mixing natural language and code too freely — "Take the number and do the maths on it" is too vague. Every step should be expressible as a single instruction. If a step requires explanation, break it into smaller steps.
Forgetting to initialise variables — if a variable appears inside a loop, set it to a starting value before the loop begins.
Missing END IF or END WHILE — without a closing keyword, it is unclear where a block finishes. Always close what you open.
Writing actual Python syntax — pseudocode is language-neutral. If you write print(), def, or == (Python-specific operators), you are writing code, not pseudocode. Use the keyword style shown above.
Frequently asked questions
What is pseudocode in simple terms for KS3?
Pseudocode is a way of writing out an algorithm using plain English and programming keywords, without worrying about the exact rules of a real programming language. It helps you plan the logic of a program before you write code, so you can focus on getting the steps right rather than fixing syntax errors.
Do you need to know pseudocode for GCSE computer science?
Yes. Both AQA and OCR GCSE computer science include written-paper questions that ask students to read, trace and write pseudocode. Each board has its own pseudocode style guide, but the core concepts — sequence, selection, iteration — are the same. Strong KS3 pseudocode practice gives a significant advantage in these exams.
Is pseudocode the same as Python?
No. Pseudocode is informal and has no strict rules — it cannot be run by a computer. Python is a specific programming language with exact syntax rules that must be followed for the code to run. Pseudocode is language-neutral planning; Python is one possible implementation of that plan.
What are the three programming constructs shown in pseudocode?
The three constructs are: sequence (instructions in order), selection (IF statements that choose a path based on a condition), and iteration (loops that repeat instructions). These three constructs are sufficient to write any algorithm — a principle known as the structured program theorem.
How long should pseudocode be?
Pseudocode should be long enough to describe every step the program takes, but no longer. There is no target word count. A simple algorithm might need three lines; a complex program might need fifty. The test is: could someone who has never seen this problem translate your pseudocode into working code without asking any questions?
For Socratic computing tutoring — from pseudocode to Python — see aitutors.me.