GCSE · Computer Science · Edexcel · Spec 1CP2
Programming arithmetic operators
Ask Python to share 14 counters between 3 people and it can give you three different answers. All three are right. The trick is knowing which one you asked for.
Computer Science · Python
14 counters, 3 people, three answers
Same 14, same 3, every line. Only the operator changes. Step through and watch each variable fill up.
Before you step: which line tells you how many counters each person gets, and which tells you how many are left on the table?
1 number = 14 / 32 counters_each = 14 // 33 counters_remaining = 14 % 3
| number | counters_each | counters_remaining |
|---|---|---|
| 4.666… |
Output
Step 1: One slash: real division. The entire value gets divided, so there's no remainder at all — just a decimal, 4.666…. Great for maths. Useless if you're handing out actual counters.
Look at the symbol, not the numbers. The numbers never change.
Computer Science · Python
Which operation is it?
Sort each expression by the operation its operator performs.
Still to sort
Addition (0)
+
Subtraction (0)
-
Multiplication (0)
A single star: *
Where the line is: One star multiplies. Two stars (**) is a different operator.
Exponentiation (0)
Two stars: **
Where the line is: score ** 2 is score to the power of two. It is not score * 2.
Real division (0)
A single slash: /
Where the line is: The entire value is divided, so there is no remainder and the result can be a decimal.
Integer division (0)
A double slash: //
Where the line is: Any remainder is discarded, leaving only a whole number. Not the same as /.
Modulo (0)
The percent sign: %
Where the line is: Returns only the remainder of a division — nothing to do with percentages.
Pick an expression, then pick the operation its symbol performs. Two pairs of lookalikes are hiding in here.
Predict, then check
Modulo isn't just for leftover counters. It can also answer a yes/no question about a number.
A program stores 13 in number and then works out number % 2. What value comes out?
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
What you need to know
- An operator is a symbol or word that tells the computer to perform a specific calculation or action.
- Python's arithmetic basics: + adds, - subtracts, * multiplies, / divides and ** is exponentiation.
- An arithmetic expression results in a numeric value — score ** 2, for instance, is score to the power of two.
Have a goYour friend Jas is certain that 4 ** 2 is 8, "because two stars just means times two". Is Jas right? And what's the real value?
Not right. 4 ** 2 is 16.
** is exponentiation, so it's 4 to the power of two (4 × 4). Times two would be 4 * 2 — the single star — which is where Jas's 8 comes from.
- Python follows the order of operations: brackets, indices, multiplication and division, then addition and subtraction, which go left to right.
Have a goNo calculator, no peeking: what does 20 - 4 * 3 + 1 evaluate to in Python?
9
Multiplication first: 4 * 3 = 12. Then - and + left to right: 20 - 12 = 8, then 8 + 1 = 9. Going strictly left to right would give 49.
- Expressions can use values stored in variables, but each variable must be assigned a value before it's used.
- Real division, /, divides the entire value, so there's no remainder: 14 / 3 gives 4.666…, a decimal.
- Integer division (also called floor division), //, discards any remainder and leaves a whole number: 14 // 3 gives 4.
- Modulo (MOD), %, returns only the remainder: 14 % 3 gives 2, because 3 goes into 14 four times with 2 over.
Have a goYour turn: what do 23 // 4 and 23 % 4 give?
5 and 3.
4 goes into 23 five times (that's 20), with 3 over. // keeps the 5 and % keeps the 3. If you said 5.75, that's what / would give.
- Sharing things out? Use // and % together: // says how many each person gets, % says how many are left.
- Modulo can check for odd numbers too: when number % 2 evaluates to 1, the number is odd.
The big picture
Python does arithmetic with +, -, *, / and **, and it has three ways to divide: / divides the entire value, // throws the remainder away, and % keeps only the remainder. It works out a line in a fixed order (brackets, indices, multiplication and division, then addition and subtraction), and any variable in an expression needs a value first.
Key points
Worked example
Problem
A program sets score = 3 and bonus = 4, then runs total = (score + bonus) * 2 ** 2 - 5. Work out the value of total, one step at a time, in Python's order.
⚠ Watch out
Thinking there's only one kind of division, or that Python works along a line from left to right. It feels natural — it's how you read. But /, // and % give different values, and the order of operations decides what gets worked out first.
Memory hook
One division, three operators: / is the full answer, // is how many each person gets, and % is the counters still sitting on the table.
Check yourself
Cover the page. A coach shares 40 bibs between 6 teams. Write the Python expression for the bibs each team gets and the one for the bibs left over, then work out both values.
Flashcards
(12)What is an operator?
What is an arithmetic expression?
In Python, what do +, -, * and / do?
What does ** do, and what does score ** 2 mean?
In what order does Python work out an expression?
+ and - sit side by side in an expression. Which goes first?
What must happen to a variable before an expression uses its value?
What is real division, and what is its Python symbol?
What does integer (floor) division do, and what is its Python symbol?
What does modulo (MOD) return, and what is its Python symbol?
Sharing things out: which two operators work as a pair, and what does each tell you?
How can modulo test whether a number is odd?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore Edexcel GCSE Computer Science topics
- Primitive data types
- Programming – condition-controlled repetition
- Programming – count-controlled repetition
- Programming – iteration over data structures
- Programming – selection
- Programming – sequencing
- Programming logical operators
- Programming relational operators
- Reading, writing, analysing and refining programs
- Single entry/exit code blocks
- String manipulation
- Structural components of programs
How this lesson was checked. This Edexcel GCSE Computer Science (specification 1CP2)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 25 October 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.