GCSE · Computer Science · AQA · Spec 8525

Multiplication (arithmetic operator)

In maths, 2n obviously means 2 times n. Type 2n into a program and the computer has no idea what you mean. One small symbol fixes it.

Computer Science · Arithmetic operators

Would the computer multiply this?

Pick a line, then decide: will the computer read it as a multiplication, or not?

Still to sort

Multiplies (0)

Doesn't multiply (0)

Where the line is: Ask yourself: is there an actual operator between the two values? If a human would have to 'just know' it means times, the computer won't.

8 of 8 still to sort.

Every line here is someone's attempt to multiply. You've written all of these in maths lessons — now test each habit against what code accepts.

Computer Science · Algorithms

Trace table — dry run the code

Painting four square walls, two coats each. The arrow ← means 'store the value on the right in the variable on the left'. Before you step, predict each new value.

1side ← 6
2area ← side * side
3walls ← 4
4paint ← area * walls
5paint ← paint * 2
6OUTPUT paint
side
area
walls
paint
Output
Press Start to run the first line.
·

Ready when you are — step through one line at a time.

Predict, then check

Does the computer work left to right, or does it follow an order rule?

A program runs the line: answer ← 2 + 3 * 4. What gets stored in answer?

Your turn

Turn a maths formula into code

The perimeter of a rectangle is P = 2(l + w). Write it as one line of code that stores the perimeter in a variable called perimeter, using variables called length and width.

  1. P = 2(l + w)Start with the maths. Hunt for the hidden multiplication: the 2 is touching the bracket, which in maths means 2 times the whole bracket.
  2. missing step
Which line is step 2?

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

Maths lets you hide the times sign. Code needs to see it.

What you need to know

  • Multiplication in pseudocode and in programming languages such as Python is written with the * operator (the asterisk).
  • The * has to be written every time: code doesn't assume a multiplication, so 2n and 2(a + b) are errors, and ab is read as one variable name.
  • × and the letter x are not operators in code.
  • In an assignment like total ← price * quantity, the right-hand side is worked out first, then the result is stored in the variable on the left.
  • * is done before +. Use brackets when you want the addition to happen first.

The big picture

In code, multiplication is written with the * operator, and it always has to be written: 2n, 2(a + b), ab, a × b and a x b don't multiply. In an assignment such as cost ← price * quantity, the right-hand side is worked out first and the result is stored in the variable on the left. * is done before + unless brackets change the order.

Key points

1Write 2 * n, never 2n.
2Spaces around * are optional — the * is not.
3x ← x * 2 takes the current value of x, doubles it, and stores the answer back in x.
42 * (a + b) and 2 * a + b are different: the brackets decide what gets doubled.

Worked example

Problem

A taxi firm's fare, in pounds, is C = 3 + 2d, where d is the distance in miles. Write this as a line of code that stores the fare in a variable called fare, then work out what is stored when distance holds 5.

⚠ Watch out

Writing multiplication the maths way: 2n instead of 2 * n, or 2(a + b) instead of 2 * (a + b). The computer won't fill in a missing *, and it reads ab as one variable called ab.

🧠

Memory hook

No star, no multiply. If you can't see the *, neither can the computer.

✓

Check yourself

Rewrite y = 4x as a line of code, then say what is stored in y when x holds 3. (Answer: y ← 4 * x, which stores 12.)

Flashcards

(7)
What symbol means multiply in code?
* — the asterisk. Not ×, and not the letter x: neither of those is an operator in code.
Why doesn't 2n work in code?
There's no operator between the 2 and the n, and the computer won't assume one. Write 2 * n.
What does the computer make of ab?
One variable name, ab — not a times b. Write a * b.
How do you write 2(a + b) in code?
2 * (a + b). Add the *, keep the brackets.
In total ← price * quantity, what happens first?
The right-hand side is worked out, then the result is stored in total.
What does x ← x * 2 do?
Takes the value x holds now, doubles it, and stores the answer back in x, replacing the old value.
Which goes first in code: * or +?
*. Use brackets if you need the + to happen first.

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 AQA GCSE Computer Science topics

See the full AQA Computer Science curriculum →

How this lesson was checked. This AQA GCSE Computer Science (specification 8525)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 30 September 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.