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 / 3
2 counters_each = 14 // 3
3 counters_remaining = 14 % 3
numbercounters_eachcounters_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…

1 / 3

Same two numbers every time. Only the operator changes.

Step 1 of 3: Single slash: real division. The entire value is divided, so there is no remainder, and the answer is a decimal: 4.666….

Watch out: Easy trap: thinking there is only one kind of division. Python has three, and they do different jobs.

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.

7 of 7 still to sort.

Pick an expression, then pick the operation its symbol performs. Watch the lookalikes.

Watch out: One star multiplies. Two stars is exponentiation. One slash divides and keeps the whole value. Two slashes throw the remainder away.

Computer Science · Order of operations

What does Python do first?

In number = 10 - 2 + 2 * 5, rank the three steps by the order Python works them out

1 · Python does this first3 · Python does this last
  1. 10 - 2

  2. 8 + 10

  3. 2 * 5

Watch out: Left to right is only the rule for + and - sitting side by side. It is not the rule for the whole line.

Computer Science · Variables in expressions

Which line breaks the program?

A student wants Python to work out the total cost of 3 items that cost 4 each, and then the change from 20. Their program is below. Which line causes the problem?

A student's program — which line goes wrong?

Exam line: Check every variable in an expression: has it been assigned a value on an earlier line?

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

1/ divides the whole value, // keeps only the whole-number part, and % keeps only the remainder.
2Brackets, then indices, then multiplication and division, then addition and subtraction. It is not simply left to right.
3Give a variable a value before any expression uses it.
4** is exponentiation, and a number % 2 that evaluates to 1 is odd.

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?
A symbol or word that instructs the computer to perform a specific calculation or action.
What is an arithmetic expression?
An expression that results in a numeric value.
What do + - * / and ** do in Python?
+ adds, - subtracts, * multiplies, / divides and ** is exponentiation.
What does score ** 2 mean?
The value of score to the power of two.
In what order does Python work out an expression?
Brackets first, then indices, then multiplication and division, then addition and subtraction.
When + and - sit together, which is done first?
Neither outranks the other: they are read from left to right.
What must happen to a variable before an expression uses its value?
It must have been assigned a value earlier in the program.
What is real division, and which Python symbol is it?
Division of the entire value, so there is no remainder and the result can be a decimal. Python uses /.
What does integer (floor) division do, and what is its Python symbol?
It discards any remainder, leaving only a whole number. Python uses //.
What does modulo (MOD) return, and what is its Python symbol?
Only the remainder of a division. Python uses %.
Which two operators work as a pair when you share things out?
// tells you how many each person gets and % tells you how many are left over.
How can modulo be used to test for an odd number?
If number % 2 evaluates to 1, the 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 posted

More Edexcel GCSE Computer Science topics

See the full Edexcel Computer Science curriculum →

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.