GCSE · Computer Science · Edexcel · Spec 1CP2

Pseudocode

It looks like code. It reads like English. And no computer can run it as it stands. That's not a flaw — that's the whole point.

Computer Science · Algorithms

Be the computer: a monthly software bill

A company charges £5 per user each month, plus 20% VAT. Here's that algorithm in pseudocode. Step through it and watch each variable fill in.

Before you press Next: with 4 users (just an example number), what will total_cost be when you reach RETURN?

1 license_cost = 5
2 vat_rate = 0.2
3 FUNCTION calculate_monthly_bill(number_users)
4 license_fee = number_users * license_cost
5 vat = license_fee * vat_rate
6 total_cost = license_fee + vat
7 RETURN total_cost
8 ENDFUNCTION
9 bill = calculate_monthly_bill(4)
10 PRINT(bill)

Variables

license_cost=5

Output

 

Step 1: First, a constant: £5 per user, per month. A constant is a value that can't be changed once the program is running.

1 / 10

One line at a time. Say the new value out loud before you reveal it.

Step 1 of 10: First, a constant: £5 per user, per month. A constant is a value that can't be changed once the program is running..

Watch out: Careful — the function isn't where things happen first. Nothing inside a function runs until something calls it, so follow the call, not just the order of the lines.

Computer Science · Algorithms

What does each line do?

Pick a line, then pick the job it does.

Still to sort

Input (0)

The program waits for the user to type something in.

Output (0)

Information is shown on the screen.

Selection (0)

A decision: one path or another.

Count-controlled iteration (0)

Repeat a set number of times.

Where the line is: FOR fixes how many times the loop runs before it starts. WHILE doesn't: it keeps checking a condition.

Condition-controlled iteration (0)

Repeat as long as a condition is met.

Where the line is: A WHILE loop may run once, many times or not at all. It depends on the condition, not on a count.

8 of 8 still to sort.

Keywords are often written in capitals so they stand out. Sort each line by the job it does — two of them are set to trip you up.

Pseudocode vs a real programming language

PseudocodevsA programming language (e.g. Python, Java, C#)

Start with the first row. It's the one that catches people out.

Focus

Can a computer run it?

Pseudocode

No. It can't be executed directly, even though it may look like real code.

A programming language (e.g. Python, Java, C#)

Yes, the computer can execute it.

The insight

Looking like code isn't the same as being code. To run pseudocode, you first translate it into a real programming language.

How strict are the rules?

Pseudocode

It doesn't follow the syntax rules of any particular language.

A programming language (e.g. Python, Java, C#)

Very strict syntax rules. The code has to follow them exactly.

Tied to one language?

Pseudocode

No. The same pseudocode can be translated into different languages.

A programming language (e.g. Python, Java, C#)

Yes. Python code is written to Python's rules.

Who is it written for?

Pseudocode

People. Plain language, close to English, so a basic knowledge of programming is enough to read it.

A programming language (e.g. Python, Java, C#)

The computer, which has to follow it exactly.

Computer Science · Algorithms

What do you really think?

You're about to plan an algorithm, and a friend leans over with some advice about pseudocode.

Which piece of advice is closest to what you believe right now?
How sure are you?

Computer Science · Algorithms

One line is lying to you

This pseudocode rolls two dice and checks for a double. RANDOM_INT(1, 6) gives a random whole number from 1 to 6. In this style, = stores a value and == compares two values. One line breaks the algorithm. Which one?

A student's pseudocode — which line goes wrong?

Computer Science · Algorithms

Your turn: explain it in words

A programmer plans a new algorithm in pseudocode before writing any real code. Give two reasons for representing the algorithm as pseudocode, and two things the programmer should do before writing it. [4 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.

Code written for people, not computers. Precise enough to follow line by line, loose enough to belong to no language.

What you need to know

  • Pseudocode is a way of expressing an algorithm that isn't tied to any specific programming language.
  • The word gives it away: 'pseudo' means pretend or fake, so pseudocode is literally 'pretend code'.
  • It uses plain language to set out an algorithm's steps in a logical order — a basic knowledge of programming is enough to follow it.
  • Looks like code? Still can't run. A computer can only execute it once it's translated into a real language like Python, Java or C#.
  • Have a goSam has written perfect pseudocode — not a single mistake — and is certain the computer will run it first time. What would you tell Sam?

    It still won't run. It has to be translated into a real programming language first.

    Being error-free isn't the problem: pseudocode doesn't follow any language's syntax rules, so even flawless pseudocode can't be executed directly.

  • Keywords are often written in capitals so they stand out: INPUT, PRINT, IF, THEN, ELSE, FOR and WHILE.
  • There's no set standard, so styles differ, even between exam boards. Whatever style you use, stay consistent and make the meaning clear.
  • Have a goOne algorithm uses PRINT("Hi") on line 2 and output "Bye" on line 6. Each line makes sense on its own. So what's wrong?

    The style isn't consistent.

    There's no set standard, but within one algorithm you stick to one style — mixing them makes a reader wonder whether the two lines do different things.

  • FOR … TO repeats a set number of times; WHILE keeps repeating as long as its condition is met.
  • Have a goYou want a program to print "Hip hip hooray!" exactly three times. FOR or WHILE?

    FOR, e.g. FOR count = 1 TO 3.

    You know the number of repeats before you start, so it's count-controlled. WHILE suits 'keep going as long as…' when the count isn't known in advance.

  • In this style, = gives a variable a value, == compares two values, and != means 'not equal to'.
  • Written descriptions, flowcharts and pseudocode can all show an algorithm. No one method is best: it depends on the problem.

The big picture

Pseudocode is a way of writing an algorithm in plain, code-like language that isn't tied to any programming language. The name means 'pretend code': it looks like code, but a computer can't execute it until it's translated into a real language such as Python, Java or C#. There's no set standard, so styles vary — just keep yours consistent and clear. Programmers use it to plan, to check a solution is possible and logical, and to catch errors before the final program exists.

Key points

1Algorithms can be shown as written descriptions, flowcharts or pseudocode. The best one depends on the problem.
2Pseudocode uses plain language to set out an algorithm's steps in a logical order.
3Programming languages have very strict syntax; pseudocode follows no particular language's rules.
4Reasons to use it: close to English, not tied to a language, helps spot and fix errors, a blueprint for the final code.
5Before writing it: understand the problem, abstract the key information, and break it into smaller steps.
6Writing pseudocode first isn't always necessary, for example for a very straightforward task.

Worked example

Problem

A program keeps asking the user to guess the password until they get it right, then it displays Welcome. The correct password is already stored in a variable called password. Write this algorithm in pseudocode.

⚠ Watch out

Treating pseudocode as if a computer could run it. It may look like real code, but it follows no language's syntax rules, so it has to be translated into a real programming language first.

🧠

Memory hook

Pseudo = pretend. Pretend code is like a recipe written for a person: a cook can follow it step by step, but you can't feed it to the oven. To make a computer run it, translate it into a real programming language.

✓

Check yourself

In your own words, explain how pseudocode differs from a real programming language, and give one reason a programmer might write pseudocode before the real code.

Flashcards

(15)
What does the 'pseudo' in pseudocode mean?
Pretend or fake. Pseudocode is 'pretend code': it looks like code but isn't a real programming language.
What is pseudocode?
A way of expressing an algorithm in plain, code-like language that is independent of any specific programming language.
Can a computer execute pseudocode directly?
No. It must first be translated into a real programming language, such as Python, Java or C#.
Name three ways of representing an algorithm.
Written descriptions, flowcharts and pseudocode.
Which is the best way to represent an algorithm?
There's no one best method. The best choice depends on the problem being solved.
How do the rules of pseudocode compare with a programming language's rules?
A programming language has very strict syntax rules. Pseudocode doesn't follow the syntax of any particular language.
Is there one standard style for pseudocode?
No. It has no set standards or conventions (unlike flowcharts), so be consistent and make your meaning clear.
How much programming knowledge do you need to read pseudocode?
Only a basic knowledge. It uses plain language to set out the steps in a logical order.
When might a programmer skip writing pseudocode first?
For a very straightforward task where the code itself is clear enough, or when an experienced programmer already has a strong grasp of the algorithm.
What does != mean?
Not equal to.
In the style used here, what's the difference between = and == ?
= stores a value in a variable. == is the comparison operator: it checks whether two values are equal.
What kind of repetition does FOR … TO give you?
Count-controlled iteration: doing something a set number of times.
What kind of repetition does WHILE give you?
Condition-controlled iteration: repeating as long as a condition is met.
What is a constant?
A value that can't be changed once the program is running.
What does RETURN do at the end of a function?
It hands a value back to the line that called the function.

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 Edexcel GCSE Computer Science topics

See the full Edexcel Computer Science curriculum →

How this lesson was checked. This Edexcel GCSE Computer Science (specification 1CP2)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 30 October 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.