Tutorpip← About this lessonABCWith the answer keyDownload PDF
Coding · Ages 10+ · Set A
Mina's guessing game
Scan to mark
on screen
A
Name
Date
Start Finish
Goal: 15 min
Score/ 11
Remember: A guessing game stores a secret and a guess and compares them with if, elif and else. A loop keeps it going until the guess equals the secret.

Read and answer

Read the story, then answer.

The guessing gameAt the club party, Mina builds a guessing game. Bo thinks of a secret number, and the player guesses it. The code stores the secret in a name called secret and the guess in a name called guess. This time the secret is seven. If the guess is less than the secret, the game says Too low. Else if it is more, the game says Too high. Else, it says You win. A single equals sign stores a value, and a double equals checks whether two things match. A loop wraps around the check and repeats until the guess equals the secret.
1
The secret is 7. How many of these guesses would get the answer Too low?
123
2
A double equals sign whether two things match.
skipsstoreschecks
3
A single equals sign stores a value in a name.
TrueFalse
4
Which line stores the number seven in a name called secret?
secret == 7secret = 7print(secret)
5
In Mina's game, the player sees the secret before guessing.
TrueFalse
6
The loop keeps asking until the guess the secret.
hidescopiesequals

Match, order and fix

7
Join each part of the game to its job.
  1. 1secret
  2. 2guess
  3. 3input
  4. 4a loop
  • Aasks the player for a guess
  • Brepeats the check until the player wins
  • Cwhat the player tries
  • Dthe number the player must find
8
Put one round of the game in order.
  • The game compares the guess with the secret
  • The loop asks again, until the guess is right
  • The player makes a guess
  • The game stores the secret
  • The game says Too low, Too high or You win
9
The secret is 4. Circle every guess that gets Too high.
16492
10
Teo writes if guess = secret: for the winning check. What is the mix-up to fix?
To check whether they match, it needs two equals signsThe colon must be a bracketGuess must have a capital G
11
Teo guesses seven when the secret is seven, so the game says You win.
TrueFalse
12
Pick a secret number from one to ten on a card. Write each guess a friend makes and what you say.
13
Draw the path that forks, with one way for Too low, one for Too high and one for You win.
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.