GCSE · Computer Science · Edexcel · Spec 1CP2
Converting algorithms to programs
Two lines, one job: PRINT "Hello" and print("Hello"). So why can a computer run only one of them?
Computer Science · Algorithms
One algorithm, two spellings
Step through the name algorithm. Each pseudocode line is followed straight away by its Python line.
At every pair of lines, ask: what is on the screen, and what does name hold? Will the Python ever give a different answer from the pseudocode?
1 pseudocode | PRINT "What is your name"2 python | print("What is your name")3 pseudocode | INPUT name4 python | name = input()5 pseudocode | PRINT "Hello" + name6 python | print(f"Hello {name}")
Variables
Output
What is your name
Step 1: Read the pseudocode like a person would: output the question. The screen shows What is your name, and name holds nothing yet.
Press Next. Watch the Output box and the Variables panel: they only change when the logic does.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Same steps, new spelling: how logic written in plain words becomes code a computer can run.
What you need to know
- An algorithm is a set of step-by-step instructions, in a logical order, that solves a problem: the logic, not any one language.
- A computer program implements an algorithm by writing it in a programming language the computer can interpret.
- For a computer to follow an algorithm, the instructions must be converted into a computer program.
Have a goMaya insists an algorithm and a computer program are just two names for the same thing. Which of the two has to be written in a language the computer can interpret?
The program.
The algorithm is the logic of the solution. The program is that logic implemented in a language, which is why converting is needed.
- You can write an algorithm as a written description, a flow chart or pseudocode, and each can be converted into a program.
- Pseudocode has no strict syntax rules, so it cannot run directly: it must be translated into a real language such as Python.
- A programming language has very strict syntax rules, and they must be followed for the computer to execute correctly.
Have a goYour pseudocode is neat, tidy and crystal clear. Can a computer run it directly? Say why or why not.
No. It has no strict syntax rules.
Neatness does not change the fact that pseudocode must be translated into a real programming language before it can be executed.
- Converting means writing each step in the chosen language's syntax. Python keywords, for example, are written in lower case.
- Pseudocode keywords are often capitalised: INPUT, PRINT, WHILE, FOR, and IF, THEN and ELSE.
- One algorithm can become many programs in different languages. They look different, but the logic stays the same.
Have a goTwo people write the same algorithm in two different languages and the programs look nothing alike. What do you expect to match?
The logic of the algorithm.
Each language has its own syntax rules, so the code differs, but the logic stays the same.
- Before converting, understand the problem, abstract the key information and, usually, decompose it into smaller steps.
The big picture
An algorithm is the step-by-step logic of a solution; a program is that logic written in a programming language with strict syntax. Converting means rewriting every step in the chosen language's syntax. The words change, the logic does not. Pseudocode has no strict syntax, so it must be translated before a computer can run it.
Key points
Worked example
Problem
Convert this pseudocode into Python. It keeps asking for a guess until the player types 7. In order: PRINT "Guess the number"; INPUT guess; WHILE guess is not 7, do PRINT "Wrong, try again" and INPUT guess again; finally PRINT "Correct".
⚠ Watch out
Treating pseudocode as a sloppy program that will run once it is tidied. It has no strict syntax rules, so it must be translated into a real programming language first. The logic carries over; the pseudocode itself does not.
Memory hook
Same steps, new spelling: the logic never moves, only the syntax does.
Check yourself
Pick any pseudocode line from this lesson and say its Python version aloud. Then say what changed in the line and what did not change in the logic.
Flashcards
(13)What is an algorithm?
What is a computer program?
Why must an algorithm be converted before a computer can follow it?
Name three ways to represent an algorithm.
Can a computer execute pseudocode directly?
What is special about a programming language's syntax?
One algorithm, two programs in different languages. What differs and what stays?
Pseudocode: what do INPUT and PRINT mean?
Pseudocode: what does WHILE do?
Pseudocode: what does FOR do?
Pseudocode: what do IF, THEN and ELSE do?
How are Python keywords written?
What should you do before converting an algorithm?
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 postedMore Edexcel GCSE Computer Science topics
- Built-in and user-devised subprograms
- Code readability techniques
- CSV file I/O
- Decomposition and abstraction in programming
- Evaluating program fitness and efficiency
- Functions vs procedures
- Global vs local variables
- Identifying and correcting program errors
- Primitive data types
- Programming – condition-controlled repetition
- Programming – count-controlled repetition
- Programming – iteration over data structures
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 21 November 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.