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.

Practise this lesson free (7 questions)

More tools

Variables and constants

A variable is a named store whose value can change while the program runs.
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

OperationPythonExampleResult
Addition+7 + 29
Subtraction-7 - 25
Multiplication*7 * 214
Division/7 / 23.5
Integer division//7 // 23
Modulus (remainder)%7 % 21
Exponentiationโˆ—โˆ— (two asterisks)2 โˆ—โˆ— 38

Relational and logical operators

Relational: == (equal to), != (not equal to), <, >, <=, >=. They give True or False.
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.
Worked example

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.

  1. 230 // 16 = 14 full buses
  2. 230 % 16 = 6 students left over

Answer: 14 full buses and 6 students left over

Key idea

Variables change, constants do not. // gives the whole-number part of a division and % gives the remainder. == compares, = assigns. and, or, not combine conditions.

Key words
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 โ†’

Common mistakes
Quick check

Try two quick questions

See if it has sunk in. Answers are marked straight away.

Extra practice

2 more questions

Try each one, then tap to check.

  1. 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.

  2. 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.

Video for this lesson coming soon. Subscribe on YouTube

Sources and references

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? โ†’

Related lessons