Tutorpip← About this lessonABCHide the answer keyDownload PDF
Coding · Ages 10+ · Set A
Bo's coin counter
Scan to mark
on screen
A
Name
Date
Start Finish
Goal: 15 min
Score/ 11
Remember: A variable is a named box that holds a value. One equals sign puts a value in, and print shows what is inside.

Read and answer

Read the story, then answer.

Where the game keeps its countZara's club game is nearly ready, and Bo hops along grabbing shiny coins. Leo asks how the game remembers how many coins Bo has. He tried tally marks on paper, but a gust of wind blew them away. The game needs somewhere to keep a number, with a name on it. Zara draws a box on the whiteboard and writes coins on its label. In Python she writes coins = 3, and three cubes drop into the box. That is a variable: a named box that holds a value. When Bo grabs one more coin, she types coins = coins + 1. Leo names a box my coins with a space, but Python refuses to read it. A name has no spaces, so he writes my_coins, and it works.
1
The box coins starts at three. What does print show?
341
2
A variable is a named that holds a value.
boxlinequote
3
One equals sign puts a value in a box.
TrueFalse
4
A variable can only hold a number.
TrueFalse
5
What does the box coins hold after these two lines?
413
6
The old three is replaced. What does the box coins hold after these two lines?
143

Match, order and fix

7
Join each line to what it does to the box.
  1. 1coins = coins + 1
  2. 2coins = coins - 1
  3. 3coins = 1
  4. 4coins == 4
  • Aputs one in and the old value is gone
  • Btakes one away
  • Casks a question and changes nothing
  • Dadds one
8
Put these lines in order so that the game prints six.
  • coins = coins * 2
  • coins = 2
  • print(coins)
  • coins = coins + 1
9
Leo names his box my coins, and Python refuses it. What is the mix-up to fix?
A name has no spaces. Write my_coinsThe box needs a number firstPrint is missing
10
The line 3 = coins is allowed in Python.
TrueFalse
11
What does this program print?
12
Write the line that makes the box called coins hold 10.
13
Draw the box called coins before and after coins = coins + 1, if it started at three.
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
Bo's coin counter
14 Python looks in the box, finds three, adds one and puts four back in the same box.
2box The name is on the box, and the value is what is inside.
3True One equals sign stores a value. Two equals signs ask a question.
4False A variable can hold a number, or some text in quotes.
53 The second line works out four but stores nothing, so the box still holds three.
61 The new value 1 goes into the box, and the old three is gone.
71-D, 2-B, 3-A, 4-C Plus one adds, minus one takes away, one equals sign stores a new value, and two equals signs only ask.
83, 1, 4, 2 Make the box with two, add one to get three, double it to get six, and print last.
9A name has no spaces. Write my_coins A name has no spaces. Use an underscore instead.
10False Only a name can sit before the equals sign. A number cannot be the name of a box.
115 The box goes 2, then 3, then 6, then 5, and print shows the 5.
12Your own words: a grown-up reads it.
Mark each answer, count the right ones and write the score on the sheet.