Tutorpip← About this lessonABCHide the answer keyDownload PDF
Coding · Ages 10+ · Set A
Zara's cupcake sums
Scan to mark
on screen
A
Name
Date
Start Finish
Goal: 15 min
Score/ 11
Remember: Python multiplies before it adds, brackets go first, a star multiplies and a slash divides and shows a decimal.

Read and answer

Read the story, then answer.

Python is a calculatorZara and Leo plan a cupcake stall for open day. Bo carries in three trays, each tray holds four cupcakes, and two more sit on a plate. Zara says Python is a calculator: plus adds, minus takes away, a star multiplies and a slash divides. She types print(2 + 3 * 4). Leo works from left to right and says twenty. The screen says fourteen, because Python multiplies before it adds: three trays of four is twelve, and the two extras make fourteen. Python was right all along. Brackets tell Python to work that part out first, so print((2 + 3) * 4) shows twenty. To share eight cupcakes between two plates, Zara types eight, a slash and two, and the screen shows 4.0.
1
What does Zara's line show on the screen?
14209
2
Now Zara puts brackets around the first part. What does the screen show?
142420
3
A star between two numbers multiplies them.
TrueFalse
4
Python always works from the first number to the last.
TrueFalse
5
What does this line show?
4164.0
6
Python multiplies with a , not with an x.
starplusslash

Match, order and fix

7
Join each line to what it shows.
  1. 1print(3 * 4)
  2. 2print(5 * 2)
  3. 3print(9 - 3 * 2)
  4. 4print(4 * 4)
  • A12
  • B3
  • C16
  • D10
8
Python works out print(2 + 3 * 4). Put its steps in order.
  • It multiplies 3 and 4 first
  • It adds the 2 to that answer
  • The screen shows fourteen
  • Python sees the whole sum
9
Zara wants 3 times 4, but this line has a mix-up to fix. Which line fixes it?
print(3 + 4)print(3 - 4)print(3 * 4)
10
This line has a mix-up to fix. What is it?
The 2 is in quotes, so it is text and cannot be addedPlus needs a star next to itThe 3 needs quotes too
11
Zara wants to show twelve using 9, 3 and 2. Which line does it?
print(9 - 3 * 2)print((9 - 3) * 2)print(9 - (3 * 2))
12
Write a Python line that shows 5 times 2.
13
Draw three trays of four cupcakes and two on a plate.
Scan the code at the top to mark this sheet on screenTake a photo of your answers or type them. It is marked for you automatically, and your score is kept.
Answer key · Set A
Zara's cupcake sums
114 Python multiplies before it adds, so 3 * 4 is worked out first, and then the 2 is added.
220 Brackets go first, so Python works out 2 + 3, and then multiplies the answer by 4.
3True Python multiplies with a star.
4False Python multiplies before it adds, and brackets change the order again.
54.0 A slash always gives a decimal, even when the answer is a whole number.
6star A star between two numbers multiplies them.
71-A, 2-D, 3-B, 4-C Work out the star first: 3 * 4 is 12, 5 * 2 is 10, 4 * 4 is 16, and in the last line 3 * 2 goes first, so 9 - 6 is 3.
82, 3, 4, 1 Multiplying comes before adding, so the star is worked out first.
9print(3 * 4) Python multiplies with a star, not an x.
10The 2 is in quotes, so it is text and cannot be added A number in quotes is text. Python cannot add text and a number.
11print((9 - 3) * 2) Brackets make 9 - 3 happen first, which is 6, and 6 * 2 is 12. The other two lines multiply 3 * 2 first and show 3.
12Your own words: a grown-up reads it.
Mark each answer, count the right ones and write the score on the sheet.