Stewdent.eu
▾

Writing Pseudocode

Pseudocode is an informal way of describing an algorithm using plain language and programming-like structure. It lets you plan your logic before worrying about the syntax of a real programming language.

Last updated: 6 January 2026

★☆☆☆☆ Level 1computingalgorithmspseudocodeproblem solving4 min read

Report an error

Before you write a single line of Python, it helps to plan what your program is going to do. Pseudocode is a way of writing out the steps of an algorithm in a mixture of plain English and programming-style structure — clear enough for a programmer to understand, but not tied to any particular language's rules.

What Is Pseudocode?

The word "pseudo" means "fake" or "not real". Pseudocode is fake code: it describes the logic without the strict rules of a real language. There is no single standard, but most pseudocode shares certain conventions.

Why Use Pseudocode?

  • You can focus on the logic without worrying about syntax errors.
  • It is language-independent — you can use the same pseudocode to write in Python, JavaScript, or any other language.
  • It is easier for non-programmers (like a client or a teacher) to read.
  • Catching a logical mistake in pseudocode is faster than hunting through hundreds of lines of code.
Note

Professional software engineers regularly sketch algorithms in pseudocode during design meetings before any code is written. It is a communication tool as much as a planning tool.

Basic Pseudocode Conventions

ConceptPseudocode example
InputINPUT name
OutputOUTPUT "Hello, " + name
AssignmentSET score ← 0
ArithmeticSET total ← price * quantity
ConditionIF score > 50 THEN ... ENDIF
Loop (count)FOR i ← 1 TO 10 DO ... ENDFOR
Loop (condition)WHILE answer ≠ "quit" DO ... ENDWHILE

There is flexibility in how you write these — different schools and exam boards use slightly different styles. The key is to be consistent.

A Simple Example

Task: ask the user for two numbers and display their sum.

Pseudocode:

INPUT firstNumber
INPUT secondNumber
SET total ← firstNumber + secondNumber
OUTPUT "The sum is: " + total

Python translation:

first_number = float(input("Enter first number: "))
second_number = float(input("Enter second number: "))
total = first_number + second_number
print("The sum is:", total)

Notice how the pseudocode maps directly onto the Python, just with less strict formatting.

Tip

Write pseudocode at the level of detail you actually need. For a simple task, one line per step is enough. For complex logic, add more detail. The goal is clarity, not perfection.

A More Complex Example

Task: find the largest number in a list.

SET maximum ← first item in list
FOR EACH number IN list DO
    IF number > maximum THEN
        SET maximum ← number
    ENDIF
ENDFOR
OUTPUT "The maximum is: " + maximum
Warning

Pseudocode should communicate intent clearly. If someone reading it has to guess what you mean, it is not clear enough. Avoid abbreviating so much that the logic becomes ambiguous.

Pseudocode in Exams

GCSE and equivalent exams often ask you to write pseudocode for a given algorithm, or to trace (follow) an existing piece of pseudocode and state what it outputs. Practising pseudocode helps with both.

Practice Problems

Write pseudocode for a program that asks the user for their age and outputs 'Adult' if they are 18 or over, or 'Minor' if they are under 18.

Show answer
INPUT age; IF age >= 18 THEN OUTPUT 'Adult' ELSE OUTPUT 'Minor' ENDIF. The exact wording may vary but must include: reading the age, a comparison with 18, and two different outputs depending on the result.

What is the main advantage of writing pseudocode before coding? Give a specific example.

Show answer
Pseudocode lets you detect logical errors before writing any real code, saving time. For example, if you are designing a login system you might realise in pseudocode that you forgot to handle the case where the username does not exist — catching this early is much faster than finding it after writing 100 lines of Python.