What is the PLS?

The Programming Language Subset (PLS) is the official list of Python commands, functions, and operators that Pearson Edexcel expect you to know for your GCSE Computer Science exam (Paper 2). This quiz tests your recall of the key items from that list.

There are 20 questions across 6 categories. Type your answer and hit Check. Good luck!

Score: 0 / 20 Question 1 of 20

PLS Reference Sheet

Now you have completed the quiz, here is a summary of the key PLS items to revise.

Data Types and Casting

Function / TypeDescriptionExample
intInteger (whole number)x = 42
floatFloating-point (decimal)x = 3.14
strString (text)x = "hello"
boolBoolean (True / False)x = True
int()Cast to integerint("15") returns 15
float()Cast to floatfloat(7) returns 7.0
str()Cast to stringstr(42) returns "42"
ord()Character to ASCII valueord("A") returns 65
chr()ASCII value to characterchr(65) returns "A"

Arithmetic Operators

OperatorNameExample
+Addition3 + 2 = 5
-Subtraction5 - 1 = 4
*Multiplication4 * 3 = 12
/Division10 / 3 = 3.33...
//Integer (floor) division10 // 3 = 3
%Modulus (remainder)10 % 3 = 1
**Exponentiation (power)2 ** 3 = 8

Relational Operators

OperatorMeaning
==Equal to
!=Not equal to
<Less than
>Greater than
<=Less than or equal to
>=Greater than or equal to

Logical Operators

OperatorDescription
andBoth conditions must be True
orAt least one condition must be True
notReverses the truth value

String Operations

OperationDescriptionExample
len()Length of a stringlen("hello") returns 5
[index]Access character at position"hello"[1] returns "e"
.upper()Convert to uppercase"hello".upper() returns "HELLO"
.lower()Convert to lowercase"HELLO".lower() returns "hello"
[start:end]Substring (slicing)"hello"[1:4] returns "ell"

Input / Output

FunctionDescription
input()Get text input from the user
print()Display output to the screen

Control Flow

KeywordDescription
forDefinite iteration (known number of times)
whileIndefinite iteration (until a condition is met)
if / elif / elseSelection (branching)

File Handling

CodeDescription
open(filename, "a")Open a file for appending
open(filename, "r")Open a file for reading
open(filename, "w")Open a file for writing
.readlines()Read all lines into a list
.readline()Read a single line
.write()Write a string to a file
.close()Close a file