GCSE · Computer Science · AQA · Spec 8525

Pseudo-code

How many days until eight people know your secret? You don’t need a laptop to find out, just a few exact lines you can follow in your head. That’s pseudo-code.

Algorithms · Pseudo-code

How many days until 8 people know?

One person knows a secret. Each day, everyone who knows tells one new person. Step through the pseudo-code and watch the values change.

Before you step through: what number do you think this will output?

1 people ← 1
2 days ← 0
3 WHILE people < 8
4 people ← people * 2
5 days ← days + 1
6 ENDWHILE
7 OUTPUT days

Variables

people=1

Output

 

Step 1: people ← 1 means “store 1 in people”. The arrow points to where the value goes. One person knows the secret.

1 / 13

Press Next one line at a time. The highlighted line is the one you’re following; the values underneath are what’s stored right now.

Step 1 of 13: people ← 1 means “store 1 in people”. The arrow points to where the value goes. One person knows the secret..

Exam line: Follow pseudo-code exactly as it’s written: one line at a time, in order, using the values stored right now.
Watch out: When people reaches 8, the check is 8 < 8. That’s false, because 8 isn’t less than itself, so the loop stops there.

Pseudo-code

So what actually is pseudo-code?

You’ve just followed the secret algorithm line by line, keeping track of people and days yourself.

Which of these is closest to what you think pseudo-code is?
How sure are you?

Three ways to show an algorithm

Where does pseudo-code fit?

The same algorithm can be written as pseudo-code, as program code or as a flowchart. Tick every property each one has, then check your grid.

Pseudo-code
Program code
Flowchart

Your turn to write

Fill in the missing lines

A film is only for people aged 12 or over. Write pseudo-code that asks for the user’s age, then outputs "You can watch it" or "Sorry, not this one".

  1. age ← USERINPUTGet the age from the user and store it in age.
  2. missing step
Which line is step 2?

Put it into words

Why plan in pseudo-code?

A programmer writes an algorithm in pseudo-code before writing any program code. Explain why this is a sensible way to plan. [3 marks]

0 words · your answer stays on this page and is not sent anywhere.

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

The algorithm without the language: plain enough for people to read, exact enough to follow step by step.

What you need to know

  • An algorithm can be represented in three ways: as pseudo-code, as program code or as a flowchart.
  • Pseudo-code uses plain language to set out the steps of an algorithm in a logical order, one after another.
  • Pseudo-code can be understood with only basic knowledge of programming.
  • Pseudo-code doesn’t follow the syntax or rules of any particular programming language, so a computer can’t run it as it is. It’s a planning tool.
  • Because it isn’t tied to one language, pseudo-code can easily be translated into different programming languages.
  • In the exam, any pseudo-code you’re given is written in one standard version, and a question that wants an algorithm tells you which form to answer in: pseudo-code, program code or a flowchart.

The big picture

Pseudo-code is a way of writing an algorithm in plain language, setting out its steps in a logical order, one after another. It’s easy to understand with only basic programming knowledge, and it’s exact enough to follow line by line with no computer. It doesn’t follow the syntax or rules of any particular programming language, so a computer can’t run it as it is. It’s a planning tool, and it can easily be translated into different programming languages. It’s one of three ways to represent an algorithm, alongside program code and flowcharts.

Key points

1Follow pseudo-code exactly: one line at a time, in order, using the values stored right now.
2Read ← as “store in”: work out the right-hand side first, then store the result in the variable on the left.
3Check a loop’s condition with the current values every time round. The loop stops as soon as the condition is false.
4Close every block with the word that matches how it opened: IF with ENDIF, WHILE with ENDWHILE.

Worked example

Problem

Write pseudo-code that asks the user for a password and keeps asking until they type "letmein". Each wrong attempt should output "Try again". When they get it right, output "Welcome".

⚠ Watch out

Reading people ← people * 2 as a maths equation that can’t be true. The arrow isn’t “equals”. It means: work out the right-hand side using the value stored now, then store the answer in the variable on the left. If people is 4, it becomes 8.

🧠

Memory hook

Pseudo-code is a recipe written for people, not machines: anyone who knows the basics can follow it by hand, but to run it you translate it into a real programming language.

✓

Check yourself

Quick check: follow x ← 5, then x ← x + 3, then OUTPUT x. What’s output? (8. x + 3 uses the value stored at that moment, 5, and the answer goes into x.)

Flashcards

(14)
What is pseudo-code?
A way of writing an algorithm in plain language, setting out its steps in a logical order, one after another.
Name three ways an algorithm can be represented.
Pseudo-code, program code and flowcharts.
Can a computer run pseudo-code as it is?
No. It doesn’t follow the syntax of any programming language, so it has to be translated into program code first.
How much programming knowledge do you need to understand pseudo-code?
Only basic knowledge of programming.
Why can pseudo-code be translated into different programming languages easily?
Because it isn’t tied to the syntax or rules of any one language.
What is pseudo-code used for?
Planning an algorithm. It’s a planning tool, not something a computer runs.
In pseudo-code, what does the arrow ← do?
It stores the value on its right in the variable on its left.
When does a WHILE loop stop repeating?
When its condition is false. The condition is checked, with the current values, each time round.
What does USERINPUT do in pseudo-code?
It gets a value typed in by the user, which can be stored in a variable, e.g. age ← USERINPUT.
What does OUTPUT do in pseudo-code?
It displays a value or message, e.g. OUTPUT days.
In IF … THEN … ELSE … ENDIF, when do the ELSE lines run?
Only when the IF condition is false. ENDIF marks where the whole choice ends.
How is pseudo-code different from a flowchart?
Pseudo-code is lines of text; a flowchart shows the steps as shapes joined by arrows. Neither follows a programming language’s syntax.
How is pseudo-code different from everyday English?
Everyday English can just state the goal. Pseudo-code gives the exact steps in order, so they can be followed one by one.
In the exam, what version of pseudo-code will any given pseudo-code use?
One standard version. A question that wants an algorithm also tells you which form to answer in: pseudo-code, program code or a flowchart.

Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.

Learning with Lightbulb is opening soon

You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.

Keep me posted

More AQA GCSE Computer Science topics

See the full AQA Computer Science curriculum →

How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 29 September 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.