GCSE · Computer Science · Edexcel · Spec 1CP2
Programming arithmetic operators
Share 14 counters between 3 people and Python gives three different answers, and all of them are right.
Computer Science · Python
14 counters, 3 people: one division, three answers
Step through a tiny program. Watch the same 14 and 3 give you three different values depending on the operator.
Which line tells you how many counters each person gets? Which one 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: Single slash: real division. The entire value is divided, so there is no remainder, and the answer is a decimal: 4.666…
Same two numbers every time. Only the operator changes.
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 the value of 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.
Pick an expression, then pick the operation its symbol performs. Watch the lookalikes.
Predict, then check
Modulo as a test, not just a remainder in a story.
A program stores 7 in number and then evaluates 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.
- In Python, + adds, - subtracts, * multiplies, / divides, and ** is exponentiation.
- An arithmetic expression results in a numeric value. For example, score ** 2 is score to the power of two.
Have a goMaya insists that 4 ** 2 is 8, because 'two stars is just times two'. Is she right? What is it really?
No. 4 ** 2 is 16: four to the power of two.
** is exponentiation, so it raises 4 to the power of two. Multiplying 4 by two would be 4 * 2, which is 8.
- Python follows the order of operations: brackets, indices, multiplication and division, then addition and subtraction (read left to right).
Have a goNo calculator, no scrolling: what does 2 + 3 * 4 evaluate to? Commit, then reveal.
14
Multiplication comes before addition, so 3 * 4 = 12 is done first, then 2 + 12 = 14. Going strictly left to right would wrongly give 20.
- An expression can use values stored in variables, but a variable must be assigned a value before it is used.
- Real division, /, divides the entire value, so there is no remainder: 14 / 3 gives 4.666…, a decimal result.
- Integer division (also called floor division) discards any remainder and leaves a whole number. Python writes it //, so 14 // 3 gives 4.
- Modulo (MOD) returns only the remainder. Python writes it %, so 14 % 3 gives 2: 3 goes into 14 four times with 2 left over.
Have a goOver to you: what do 17 // 5 and 17 % 5 give?
3 and 2.
5 goes into 17 three times (that uses 15), leaving 2 over. // keeps the 3 and % keeps the 2.
- // and % work as a pair: // says how many each person gets, and % says how many are left over.
- Modulo also tests for odd numbers: if number % 2 evaluates to 1, the number is odd.
The big picture
Python has +, -, *, / and ** for arithmetic, and three different kinds of division: / keeps the whole value, // throws the remainder away and % keeps only the remainder. Python also works in a set order of operations, and a variable needs a value before an expression can use it.
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
Believing there is only one kind of division, or that Python always works a line from left to right. Real division, integer division and modulo give different values, and the order of operations decides what is worked out first.
Memory hook
One division, three operators: / is the whole answer, // is how many each person gets, % is the counters left on the table.
Check yourself
Without scrolling back: a teacher shares 25 pencils between 6 pupils. Which operator tells you how many each pupil gets, which tells you how many are left over, and what are the two values?
Flashcards
(12)What is an operator?
What is an arithmetic expression?
What do + - * / and ** do in Python?
What does score ** 2 mean?
In what order does Python work out an expression?
When + and - sit together, which is done first?
What must happen to a variable before an expression uses its value?
What is real division, and which Python symbol is it?
What does integer (floor) division do, and what is its Python symbol?
What does modulo (MOD) return, and what is its Python symbol?
Which two operators work as a pair when you share things out?
How can modulo be used to test for an odd number?
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
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 9 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.