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