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 / Type | Description | Example |
|---|---|---|
int | Integer (whole number) | x = 42 |
float | Floating-point (decimal) | x = 3.14 |
str | String (text) | x = "hello" |
bool | Boolean (True / False) | x = True |
int() | Cast to integer | int("15") returns 15 |
float() | Cast to float | float(7) returns 7.0 |
str() | Cast to string | str(42) returns "42" |
ord() | Character to ASCII value | ord("A") returns 65 |
chr() | ASCII value to character | chr(65) returns "A" |
Arithmetic Operators
| Operator | Name | Example |
|---|---|---|
+ | Addition | 3 + 2 = 5 |
- | Subtraction | 5 - 1 = 4 |
* | Multiplication | 4 * 3 = 12 |
/ | Division | 10 / 3 = 3.33... |
// | Integer (floor) division | 10 // 3 = 3 |
% | Modulus (remainder) | 10 % 3 = 1 |
** | Exponentiation (power) | 2 ** 3 = 8 |
Relational Operators
| Operator | Meaning |
|---|---|
== | Equal to |
!= | Not equal to |
< | Less than |
> | Greater than |
<= | Less than or equal to |
>= | Greater than or equal to |
Logical Operators
| Operator | Description |
|---|---|
and | Both conditions must be True |
or | At least one condition must be True |
not | Reverses the truth value |
String Operations
| Operation | Description | Example |
|---|---|---|
len() | Length of a string | len("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
| Function | Description |
|---|---|
input() | Get text input from the user |
print() | Display output to the screen |
Control Flow
| Keyword | Description |
|---|---|
for | Definite iteration (known number of times) |
while | Indefinite iteration (until a condition is met) |
if / elif / else | Selection (branching) |
File Handling
| Code | Description |
|---|---|
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 |