Read the map from the bottom. Year 7 starts on the left, and the line climbs through Years 8 and 9 into IGCSE, then on to IB in the sixth form.
Dashed rings mark this half-term's units. Taught half-terms are ticked in the year plans.
When each Year 7–9 unit is taught. Select a unit to see its lessons.
Cambridge IGCSE Computer Science (0478) across Years 10 and 11, 3 lessons a week. Select a topic to see what it covers and open its lessons.
IB Diploma Computer Science for the 2027 exams, across Years 12 and 13, 4 lessons a week. It follows the IB's suggested order: A1 to A3 and then programming (B1 to B3) in Year 12; the internal assessment, A4 Machine learning and the Paper 1 case study in Year 13. HL extensions are taught alongside each topic.
New free lessons, worksheets and revision sheets for Computer Science, sent to your inbox.
How to write pseudocode the way the exam expects, with the Python you already know beside it. In the exam, write the pseudocode; the Python is only there to help you compare.
// This is a comment
A comment. The computer ignores it.
# This is a comment
DECLARE Score : INTEGER
Create a variable and give its data type.
score = 0
CONSTANT VAT ← 0.2
A value that never changes while the program runs.
VAT = 0.2
Score ← Score + 1
Assignment: the arrow stores the value on the right in the variable on the left.
score = score + 1
INPUT Name
Read a value from the user into a variable.
name = input()
OUTPUT "Hello ", Name
Show values on the screen. Separate items with commas.
print("Hello", name)INTEGER
A whole number: 42, -7
int
REAL
A number with a decimal point: 3.5, -0.25
float
CHAR
A single character, in single quotes: 'A'
str (one character)
STRING
Text, in double quotes: "Hello"
str
BOOLEAN
TRUE or FALSE
True / False
+ - * /
Add, subtract, multiply, divide. 7 / 2 gives 3.5
+ - * /
2 ^ 3
Raise to a power: gives 8
2 ** 3
DIV(9, 4)
Whole-number division: gives 2
9 // 4
MOD(9, 4)
Remainder after division: gives 1
9 % 4
ROUND(3.14159, 2)
Round to 2 decimal places: gives 3.14
round(3.14159, 2)
RANDOM()
A random real number from 0 to 1
random.random()
= <> < <= > >=
Equal, not equal, less than, less than or equal, greater than, greater than or equal
== != < <= > >=
AND OR NOT
Combine or reverse conditions
and or not
The first character of a string is position 1.
LENGTH("Happy")Number of characters: gives 5
len("Happy")UCASE("hello")Upper case: gives "HELLO"
"hello".upper()
LCASE("HELLO")Lower case: gives "hello"
"HELLO".lower()
SUBSTRING("Happy Days", 1, 5)Part of a string: start at position 1, take 5 characters. Gives "Happy"
"Happy Days"[0:5]
IF Score >= 50
THEN
OUTPUT "Pass"
ELSE
OUTPUT "Try again"
ENDIFif score >= 50:
print("Pass")
else:
print("Try again")CASE OF Grade 'A' : OUTPUT "Excellent" 'B' : OUTPUT "Good" OTHERWISE OUTPUT "Keep going" ENDCASE
if grade == "A":
print("Excellent")
elif grade == "B":
print("Good")
else:
print("Keep going")FOR Count ← 1 TO 10 OUTPUT Count NEXT Count
for count in range(1, 11):
print(count)FOR Count ← 0 TO 20 STEP 5 OUTPUT Count NEXT Count
for count in range(0, 21, 5):
print(count)WHILE Guess <> Answer DO INPUT Guess ENDWHILE
while guess != answer:
guess = input()REPEAT INPUT Password UNTIL Password = "Secret1"
while True:
password = input()
if password == "Secret1":
breakIn these examples the first index is 1. Python lists start at 0.
DECLARE Marks : ARRAY[1:30] OF INTEGER
A one-dimensional array of 30 integers
marks = [0] * 30
Marks[1] ← 75
Store a value in the first element
marks[0] = 75
DECLARE Board : ARRAY[1:3, 1:3] OF CHAR
A two-dimensional array: 3 rows and 3 columns
board = [[" "] * 3 for r in range(3)]
Board[2, 3] ← 'X'
Row 2, column 3
board[1][2] = "X"
PROCEDURE Greet(Name : STRING)
OUTPUT "Hello ", Name
ENDPROCEDURE
CALL Greet("Aru")def greet(name):
print("Hello", name)
greet("Aru")FUNCTION Square(Number : INTEGER) RETURNS INTEGER RETURN Number * Number ENDFUNCTION Result ← Square(4)
def square(number):
return number * number
result = square(4)OPENFILE "scores.txt" FOR WRITE WRITEFILE "scores.txt", Name CLOSEFILE "scores.txt"
f = open("scores.txt", "w")
f.write(name + "\n")
f.close()OPENFILE "scores.txt" FOR READ READFILE "scores.txt", Line CLOSEFILE "scores.txt"
f = open("scores.txt", "r")
line = f.readline()
f.close()These are the methods named in the syllabus. Marks is an array of 30 marks.
Total ← 0
PassCount ← 0
Highest ← Marks[1]
Lowest ← Marks[1]
FOR Index ← 1 TO 30
Total ← Total + Marks[Index]
IF Marks[Index] >= 50
THEN
PassCount ← PassCount + 1
ENDIF
IF Marks[Index] > Highest
THEN
Highest ← Marks[Index]
ENDIF
IF Marks[Index] < Lowest
THEN
Lowest ← Marks[Index]
ENDIF
NEXT Index
Average ← Total / 30total = 0
pass_count = 0
highest = marks[0]
lowest = marks[0]
for mark in marks:
total = total + mark
if mark >= 50:
pass_count = pass_count + 1
if mark > highest:
highest = mark
if mark < lowest:
lowest = mark
average = total / 30Found ← FALSE
Index ← 1
WHILE Found = FALSE AND Index <= 30 DO
IF Names[Index] = Target
THEN
Found ← TRUE
ELSE
Index ← Index + 1
ENDIF
ENDWHILE
IF Found = TRUE
THEN
OUTPUT "Found at position ", Index
ELSE
OUTPUT "Not found"
ENDIFfound = False
index = 0
while not found and index < 30:
if names[index] == target:
found = True
else:
index = index + 1
if found:
print("Found at position", index + 1)
else:
print("Not found")REPEAT
Swapped ← FALSE
FOR Index ← 1 TO 29
IF Marks[Index] > Marks[Index + 1]
THEN
Temp ← Marks[Index]
Marks[Index] ← Marks[Index + 1]
Marks[Index + 1] ← Temp
Swapped ← TRUE
ENDIF
NEXT Index
UNTIL Swapped = FALSEswapped = True
while swapped:
swapped = False
for i in range(29):
if marks[i] > marks[i + 1]:
marks[i], marks[i + 1] = marks[i + 1], marks[i]
swapped = True