Uni-Sine
UK examsGCSE

Edexcel GCSE Computer Science Programming Language Subset (1CP2): the Python you need

Paper resets in

Formula sheet

The card below opens today's Computer Science paper with the language reference in the drawer, so you practise with the Python the paper uses. The tables follow, in our own layout. This guide follows Version 6 of the PLS, so check Pearson's site for the version for your series before you rely on anything here.

Formula sheet

GCSE Computer Science

Open formula sheet

Operators

OperatorMeaningExample
/ * **divide, multiply, raise to a power2 ** 3 is 8
+ -add, subtracta + b
//integer division23 // 5 is 4
%modulus (remainder)23 % 5 is 3
== != > >= < <=relational testsx != 7
and or notBoolean testsnot (a < b)

Data types

Conversion uses int(), str(), float(), bool() or list(). Constants are named in all capitals by convention.

TypeIn the subsetNote
integerintwhole numbers
realfloatnumbers with a decimal part
BooleanboolTrue or False
character and stringstra sequence of characters, indexed from 0
array and recordlistindexed from 0, up to two dimensions

Selection and loops

Blocks are shown by indentation. The stop value of range() is not included, and start and step are optional.

ConstructFormExample
ifif condition: ...if x > 3:
elseelse: ...else:
elifelif condition: ...elif x == 3:
whilewhile condition: ...while total < 100:
for over a structurefor item in structure: ...for name in names:
for over a rangefor i in range(start, stop, step): ...for i in range(2, 11, 4):

Subprograms, input and output

The subset supports comma separated value text files.

ConstructFormExample
proceduredef name(parameters): ...def greet(name):
functiondef name(parameters): ... return (value)return (total)
outputprint(item)print("Hello")
inputinput(prompt)name = input("Name? ")
read a fileopen(name, "r") readline() readlines()f = open("data.csv", "r")
write a fileopen(name, "w") or "a" write() writelines()f.write("text")
close a fileclose()f.close()

Built-in subprograms

ItemWhat it doesExample
len(object)length of a string or listlen("keyboard") is 8
chr(n) and ord(c)character from code, code from characterord("a") is 97
range(start, stop, step)generates numbers, stop not includedrange(2, 11, 4)
round(x, n)rounds x to n decimal places, with the 0.5 ruleround(3.14159, 2) is 3.14
int() float() str() bool()convert between typesint("16") is 16

Lists and strings

The subset also supports isalpha(), isalnum(), isdigit(), isupper() and islower(), string slicing such as name[0:2], and "=" * 10 to repeat a string.

ItemWhat it doesExample
list.append(item)add to the endnames.append("Ada")
list.insert(index, item)insert before the item at indexnames.insert(0, "Bo")
del list[index]remove the item at indexdel names[2]
string.find(sub)first position, or -1text.find("a")
string.index(sub)first position, or an exceptiontext.index("a")
string.upper() .lower()change casetext.upper()
string.replace(s1, s2)replace every s1 with s2text.replace("a", "o")
string.split(char)split into a listline.split(",")
string.strip(char)remove char from the endstext.strip(" ")
string.format(values)format values into placeholders"{:>6.2f}".format(x)

Library modules

A module must be imported before use, for example import random. The subset also has a turtle module for graphics.

ItemWhat it doesExample
random.randint(a, b)random integer from a to b inclusiverandom.randint(1, 6)
random.random()random float from 0.0 to 1.0random.random()
math.ceil(x) math.floor(x)round up, round downmath.floor(2.7) is 2
math.sqrt(x) math.pisquare root, and pimath.sqrt(49) is 7.0
time.sleep(seconds)pause the programtime.sleep(2)

Reading the Python subset

Python shows a block by indenting it, so the layout is part of the code. Trace this short program:

total = 0
for n in range(1, 6):
    total = total + n * n
print(total)

range(1, 6) gives 1, 2, 3, 4 and 5, because the stop value is not included. The total adds 1, 4, 9, 16 and 25, so the program prints 55.

nn * ntotal
111
245
3914
41630
52555

Dividing, strings and a function

23 // 5 is 4 and 23 % 5 is 3, because 23 = 4 × 5 + 3. range(2, 11, 4) gives 2, 6 and 10. This function returns a value:

def is_even(n):
    if n % 2 == 0:
        return (True)
    else:
        return (False)

print(is_even(17))

17 % 2 is 1, so the condition is false and the program prints False.

What the subset does not give you

  • Which structure to use. It lists while and for loops. Choosing the right one for a question is yours to do.
  • Algorithms. Searching, sorting and the other algorithms are not written out. You need to know how they work.
  • Python beyond the subset. Pearson will not set tasks beyond the PLS, but you may use more if your solution is valid.
  • Ragged data structures. The PLS does not support them: each record in a list has the same number of fields.
  • Errors. It does not say what a syntax error or a logic error looks like, so learn to spot both.

How to use the subset in the exam

  1. Read the whole program once before you trace it.
  2. Make a table with a column for each variable and one row for each pass of a loop.
  3. Remember that strings and lists start at index 0.
  4. Check the stop value of range(): it is not included.
  5. Keep your indentation consistent, because it shows the blocks.

The subset and other boards' languages

AQA uses its own pseudo-code and OCR uses its own Exam Reference Language, with different keywords. Use the one your board names: see our AQA pseudo-code and OCR Exam Reference Language guides. For the boards, papers and grade boundaries, see our GCSE Computer Science guide.

Use the sheet with today's paper

Uni-Sine publishes a free daily paper for GCSE Computer Science. It is a short timed paper of 8 questions worth 25 to 35 marks, not a full Edexcel paper, and it is not written by Pearson. Open the reference, set a timer and write your trace table at the top of each answer. After marking, look at any question where you used the wrong loop or the wrong operator.

Common mistakes

  • Off by one with range(). range(1, 6) stops at 5, because the stop value is not included.
  • Mixing up // and %. // is the whole number quotient and % is the remainder.
  • Using = to compare. = assigns, and == compares.
  • Forgetting the colon. if, elif, else, while, for and def lines all end with a colon.
  • Counting from 1. Strings and lists start at index 0.
  • Forgetting to convert input. input() returns text, so use int() or float() before arithmetic.

Exam answers

The answers and a worked mark scheme come with today's paper once it is marked. Sit the paper with the sheet open beside you, mark it, and the worked answers show which line of the sheet each question wanted. We do not publish official or past paper answers.

Common questions

What is the Edexcel Programming Language Subset?
It is a Pearson document that specifies which parts of Python 3 are required so that Paper 2 (1CP2/02) can be taken with confidence.
Does the PLS limit what Python I can use?
Pearson says it will not go beyond the PLS when setting tasks, but a student who successfully uses something outside it will still earn marks if the solution is valid.
Which version of Python does Edexcel use?
Python 3. The subset describes the parts of Python 3 that the assessment needs.
What is the difference between // and % in the PLS?
// is integer division and % is the modulus, the remainder. 23 // 5 is 4 and 23 % 5 is 3.
Does the PLS include turtle graphics?
Yes. It lists a set of turtle module subprograms for the window, the turtle, its movement, pen, fills, circles and colours.

Revision cards

Say the answer first, then flip the card to check it.

Where to go next

  • Solve it

    Code Editor

    Write and run code right in your browser

    Open the tool
  • Learn it

    Programming Languages

    Compiled vs interpreted, paradigms and the evolution of how we talk to machines

    Start the course
  • Test it

    GCSE Computer Science

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
Read next
UK · GCSEEdexcel GCSE Computer Science (1CP2): papersEdexcel GCSE Computer Science 1CP2 explained: the written paper, the on-screen Python paper, the six topics, worked examples and June 2026 boundaries.