Tutorpip← About this lessonABCWith 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.