Variables, constants and operators
Programs store values in variables and constants, then work on them with operators. Integer division and modulus come up in almost every exam.
Variables and constants
A constant is a named value that does not change, such as VAT = 0.2.
Constants make code easier to read, and if the value ever changes you only edit it in one place.
Arithmetic operators in Python
| Operation | Python | Example | Result |
|---|---|---|---|
| Addition | + | 7 + 2 | 9 |
| Subtraction | - | 7 - 2 | 5 |
| Multiplication | * | 7 * 2 | 14 |
| Division | / | 7 / 2 | 3.5 |
| Integer division | // | 7 // 2 | 3 |
| Modulus (remainder) | % | 7 % 2 | 1 |
| Exponentiation | โโ (two asterisks) | 2 โโ 3 | 8 |
Relational and logical operators
Logical: and, or, not combine True/False values.
(age >= 13) and (age <= 19) is True only for teenagers.
Remember: = assigns a value, == compares two values.
A school has 230 students and each minibus seats 16. Use integer division and modulus to find how many buses are full and how many students are left over.
- 230 // 16 = 14 full buses
- 230 % 16 = 6 students left over
Answer: 14 full buses and 6 students left over
Variables change, constants do not. // gives the whole-number part of a division and % gives the remainder. == compares, = assigns. and, or, not combine conditions.
- Modulus
- The remainder after division, % in Python.
- Variable
- A named store whose value can change while the program runs.
- Constant
- A named value that does not change while the program runs.
All GCSE and International GCSE Computer Science key terms and definitions โ
- Not โ==โ. == means equal to.
- Not โ<>โ. <> is not used in Python 3.
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 the result of 23 // 4 in Python?
Show the answer
Answer: 5
// is integer division: 23 รท 4 = 5 remainder 3, so the result is 5.
What is the result of 23 % 4 in Python?
Show the answer
Answer: 3
% gives the remainder: 23 รท 4 = 5 remainder 3, so the result is 3.
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 GCSE Computer Science (1CP2) specification, topic 1.2.2, 1.2.3, 6.3.2, 6.5
- Pearson Edexcel International GCSE Computer Science (4CP0) specification, topic 2.3.4, 2.5
Facts checked against the sources below, 17 October 2026. Last updated 2 October 2026. Spotted a mistake? Tell us and we will fix it.
What do exam command words like explain and evaluate mean? โ