Pearson pseudocode: variables, selection and loops
Paper 1 questions may show algorithms in Pearson's own pseudocode (the command set in Appendix 5 of the specification). You need to read it fluently. You may write your own answers in any clear pseudocode or in a programming language.
Variables, input and output
RECEIVE mark FROM (INTEGER) KEYBOARD reads input and says its data type.
SEND total TO DISPLAY outputs a value. The & operator joins strings, so SEND 'Fred' & age TO DISPLAY with age 18 shows Fred18.
Operators: + - * / as usual, MOD (remainder) and DIV (whole-number division). Comparisons use = for equal and <> for not equal. Logic uses AND, OR and NOT. Comments start with #.
Selection
RECEIVE mark FROM (INTEGER) KEYBOARD
IF mark >= 50 THEN
SEND 'Pass' TO DISPLAY
ELSE
SEND 'Fail' TO DISPLAY
END IF
Python equivalent: if mark >= 50: print("Pass") else: print("Fail").
Four kinds of loop
| Pseudocode | What it does | Python |
|---|---|---|
| WHILE condition DO ... END WHILE | Checks first; may run zero times | while condition: |
| REPEAT ... UNTIL condition | Runs at least once; stops when the condition is True | No direct equivalent |
| REPEAT 5 TIMES ... END REPEAT | Runs a fixed number of times | for i in range(5): |
| FOR i FROM 1 TO 10 DO ... END FOR | Counts from 1 to 10, including 10 | for i in range(1, 11): |
Tracing pseudocode
SET total TO 0
FOR count FROM 1 TO 4 DO
SET total TO total + count
END FOR
SEND total TO DISPLAY
total goes 1, 3, 6, 10, so it outputs 10. Note that FOR ... FROM 1 TO 4 includes 4, unlike range(1, 4) in Python.
What is output by this pseudocode?
SET number TO 1
REPEAT
SET number TO number * 3
UNTIL number > 50
SEND number TO DISPLAY
- REPEAT runs the body first: number becomes 3, then 9, 27 and 81.
- After each pass the condition is checked: 81 > 50 is the first True result.
- The loop ends and 81 is sent to the display.
Answer: 81
Pearson pseudocode uses SET ... TO for assignment, RECEIVE and SEND for input and output, & to join strings, MOD and DIV, IF ... THEN ... ELSE ... END IF, and WHILE, REPEAT ... UNTIL, REPEAT n TIMES and FOR ... FROM ... TO loops. FOR includes its end value.
- Selection
- Choosing which code runs using a condition, such as if, elif and else.
- Assignment
- Storing a value in a variable, such as total = 0.
- MOD and DIV
- Remainder and integer division. Python: % and //
- IF ... THEN ... ELSE ... END IF
- Selection. Python: if ...: then else:
- SET total TO 0
- Assignment. Python: total = 0
- Constant
- A named value that does not change while the program runs.
All GCSE and International GCSE Computer Science key terms and definitions →
Try two quick questions
See if it has sunk in. Answers are marked straight away.
2 more questions
Try each one, then tap to check.
What is output?
SET count TO 1
REPEAT 4 TIMES
SET count TO count + 3
END REPEAT
SEND count TO DISPLAYShow the answer
Answer: 13
count: 1 → 4 → 7 → 10 → 13.
What is output?
SET n TO 10
WHILE n < 5 DO
SET n TO n - 1
END WHILE
SEND n TO DISPLAYShow the answer
Answer: 10
10 < 5 is false at the start, so the loop body never runs and n stays 10.
Check you have got it
Answer 7 quick questions with instant marking. If you get one wrong, GCSE-ready shows you why and gives you another go. It is free, and you do not need an account.
- Pearson Edexcel International GCSE Computer Science (4CP0) specification, topic 1.1.1, 1.1.2, 1.1.3, 1.1.4
- Pearson Edexcel International GCSE Computer Science: pseudocode command set
- Pearson Edexcel International GCSE Computer Science specification
Checked by the GCSE-ready editorial team, 17 October 2026. Last updated 2 October 2026. Spotted a mistake? Tell us and we will fix it.