Remember: Input waits for a person and keeps what they type as text. Wrap it in int to get a whole number, and use print to show it.
Read and answer
Read the story, then answer.
Zara's boothOpen day comes, and Zara sets up a booth with Bo and a laptop. She wants the program to greet each visitor by name, but Python cannot know who will come, so it has to ask. A command called input puts a question on the screen and waits. A visitor called Mia types her name and presses Enter. Only then does Python carry on, and the answer goes into a box called name. Input only keeps the answer, so a print line is needed to show it. Next Zara asks for an age and tries to add one. A message says Python cannot add a number to text. The fix is a command called int, which turns text into a whole number.
1
Python reaches an input line. What does it do?
🏃It keeps going and guesses the answer⏳It waits until the person types and presses Enter🖥️It shows the answer by itself
2
The typed answer is kept in a box called a .
quotecommandvariable
3
Input shows what the person typed on the screen by itself.
TrueFalse
4
Mia types 12 into this line. What is in the box age?
The number 12An error messageThe text 12
5
Mia types 3 into the line pets = int(input("Pets? ")). What is in the box pets?
The number 3The text 3Nothing yet
6
Whatever a person types arrives as text, even digits.
TrueFalse
Match, order and fix
7
Join each word to its job.
1input
2print
3int
4a variable
Akeeps the typed answer in a box
Bturns text into a whole number
Casks a question and waits for typing
Dshows a message on the screen
8
Mia uses the booth. Put what happens in order.
Mia types her name and presses Enter
The answer goes into the box called name
The program says hi to Mia
Python waits
The program shows the question
9
One of these lines has a mix-up to fix. Which one?
Mia types twelve and int turns it into a number. Zara adds one, and twelve plus one is .
11
Python keeps running while it waits for a person to type.
TrueFalse
12
Write an input line that asks a visitor for a favorite color.
13
Draw a box with the word name on it, and a visitor's answer inside.
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
The greeting booth
1It waits until the person types and presses Enter Input pauses the program until a person types.
2variable The answer goes into a variable, such as the box called name.
3False Input only keeps the answer. To show it, you still need print.
4The text 12 Whatever a person types arrives as text, even digits.
5The number 3 int wraps around input and turns the typed text into a whole number.
6True That is why Python could not add one to the twelve until int turned it into a number.
71-C, 2-D, 3-B, 4-A Input asks, print shows, int changes text to a number, and a variable keeps the answer.
83, 4, 5, 2, 1 The program asks, Python waits, the person answers, the answer is kept, and then it is used.
9snacks = int(input "Snacks? ") Input needs brackets around the question: int(input("Snacks? ")).
1013 With int, the twelve is a number, so 12 + 1 makes 13.
11False Python waits until the person presses Enter.
12Your own words: a grown-up reads it.
Mark each answer, count the right ones and write the score on the sheet.