Skip to content

Pseudocode

GCSE Computer Science pseudocode guide

Turn Python thinking into exam-style algorithms. Every building block in AQA pseudo-code, OCR Exam Reference Language and Python, side by side.

Miss ICT GCSE Computer Science Pseudocode Guide poster

What pseudocode is for

Pseudocode describes an algorithm in structured English, without worrying about the exact rules of a programming language. In the exam it lets you show your logic clearly. Examiners mark the logic, so small differences in notation rarely lose marks, as long as your steps are clear and in the right order.

AQA publishes its own pseudo-code, and OCR uses an Exam Reference Language. Questions on your paper will be written in your board's style, so learn to read it fluently.

Side by side

Building blockAQA pseudo-codeOCR Exam Reference LanguagePython
OutputOUTPUT "Hello"print("Hello")print("Hello")
Inputname ← USERINPUTname = input("Name")name = input("Name")
Assignmenttotal ← 0total = 0total = 0
Equal toage = 16age == 16age == 16
Not equalage ≠ 16age != 16age != 16
SelectionIF age ≥ 16 THEN
  …
ELSE
  …
ENDIF
if age >= 16 then
  …
else
  …
endif
if age >= 16:
  …
else:
  …
Count loopFOR i ← 1 TO 10
  …
ENDFOR
for i = 1 to 10
  …
next i
for i in range(1, 11):
  …
Condition loopWHILE total < 100
  …
ENDWHILE
while total < 100
  …
endwhile
while total < 100:
  …
Repeat untilREPEAT
  …
UNTIL x = 0
do
  …
until x == 0
No direct equivalent
Arraynums ← [3, 7, 1]array nums[3]nums = [3, 7, 1]
FunctionSUBROUTINE add(a, b)
  RETURN a + b
ENDSUBROUTINE
function add(a, b)
  return a + b
endfunction
def add(a, b):
  return a + b

Pearson Edexcel assesses programming on screen in Python, so Edexcel students should focus on the Python column. Always check your board's current reference guide.

A worked example

Task: ask for a number, then output the total of every whole number from 1 up to it.

number ← USERINPUT
total ← 0
FOR i ← 1 TO number
  total ← total + i
ENDFOR
OUTPUT total

Five habits that earn marks

  1. Plan in plain English first. Write the steps as a list, then turn each step into pseudocode.
  2. Indent inside every IF and loop. It shows the examiner where each block starts and ends.
  3. Close every structure. ENDIF, ENDFOR, ENDWHILE. Missing endings make logic ambiguous.
  4. Use meaningful names. total and score, not x and y.
  5. Trace it. Run your pseudocode with a small test value before moving on.
Break the problem down. Write the steps. Earn the marks. If you can explain an algorithm out loud, you can write it as pseudocode.

Questions

Common questions

Will I lose marks if my pseudocode isn't exactly my board's style?

Usually not. Unless a question asks for a specific language, examiners mark whether your logic is correct and clear. Using your board's style makes your answer easier to follow.

Can I write Python instead of pseudocode?

On most questions that ask for an algorithm, yes, unless the question says otherwise. Read each question carefully.

How can I practise?

Take any short Python program you have written and rewrite it as pseudocode, then trace it. Dee builds this into every GCSE lesson.

Want help with this one to one?

Dee replies personally to every enquiry, usually within two working days.

Send an enquiry