Python arithmetic operators and expressions
GCSE Computer Science specifications all require pupils to use Python's arithmetic operators correctly and reason about the order in which they're evaluated. This unit covers +, -, *, /, integer division //, modulo %, exponentiation **, and how brackets change evaluation order (BIDMAS applies). It also introduces the classic exam distinction between / (returns a float) and // (returns an int, discarding the remainder) — the source of a large fraction of GCSE Python marks lost each summer. Perfect for classroom teaching, GCSE and A Level revision, and independent or home-schooled learners.
What you'll learn
- Add, subtract, multiply and divide numbers
- Distinguish / (float division) from // (integer division)
- Use % (modulo) to test for even/odd and other remainders
- Use ** for exponentiation (e.g. 2 ** 3 = 8)
- Control evaluation order with brackets
UK GCSE topic coverage
- Arithmetic operators (`+`, `-`)
- Arithmetic operators (`*`, `/`)
- Operators `//` and `%`
- Operator `**`
- Operator precedence (BIDMAS)
- Dry-run and trace tables
- Compound assignment (`+=`, `-=`, `*=`, `/=`)
- Applied I/O and arithmetic
Worked example
Integer division and modulo
total_minutes = 137
hours = total_minutes // 60
minutes = total_minutes % 60
print(hours, "hours and", minutes, "minutes")Try a full unit free with a RunPy account
Sign up free and get the whole of Unit 1 (Input, Output and Variables) with checked tasks and instant feedback, plus a selection of the exam-style questions so you can practice on real GCSE-style content before upgrading.
Lessons in this unit
Full interactive lessons with checked tasks are available to signed-in RunPy users. Unit 1 and a selection of exam-style questions are free with a RunPy account.
- Addition and subtraction with variables
- Multiplication and division
- Integer division and remainder
- Powers and exponents
- Order of operations
- Tracing expressions with updates
- Shortened update operators
- Building multi-input programs
Frequently asked questions
- What's the difference between / and // in Python?
- / always returns a float (10 / 4 = 2.5). // is integer division and discards the remainder (10 // 4 = 2). GCSE questions specifically test this distinction.
- What does % mean in Python?
- % is the modulo operator: it returns the remainder of a division. 10 % 3 is 1. It's most commonly used to test 'is this number even?' with n % 2 == 0.
- Does Python follow BIDMAS?
- Yes. Brackets first, then exponentiation, then multiplication/division, then addition/subtraction. Use brackets liberally to make intent clear.