Tutorpip← About this lessonAHide the answer keyDownload PDF
Coding · Ages 10+ · Set A
Mina teaches Bo to cheer
Scan to mark
on screen
A
Name
Date
Start Finish
Goal: 15 min
Score/ 11
Remember: A function is a named bundle of lines. Def writes it down, a call runs it, and a parameter is a blank you fill in.

Read and answer

Read the story, then answer.

The finaleBo's finale is a spin, a clap and a bow, and it happens three times in the show. Mina typed the three moves three times and had nine lines. Then she wanted a deeper bow, so she had to fix it three times. Ms. Ola says a function is a bundle of lines with a name. Mina writes def cheer(): and pushes the moves in under it. When she runs it, Bo stands still, because def only writes the recipe down. To make Bo cheer, Mina calls the function by writing cheer() on a line of its own. Later she makes a function with a blank, a parameter: greet("Bo") says hi Bo, and greet("Teo") says hi Teo.
1
A program has only the def cheer lines and no line that calls cheer. What does Bo do?
🔄Bo spins three times🧍Bo does nothing, because def only writes the recipe down🙇Bo bows once
2
A function runs only when it is by its name.
writtencalledsaved
3
Def writes a function down, and a call runs it.
TrueFalse
4
Which line is the call that makes Bo cheer?
line 1line 5line 3
5
A program has the def lines and then the line cheer() written three times. How many times does Bo cheer?
OnceNine timesThree times
6
To make the bow deeper in all three cheers, Mina must fix it in three places.
TrueFalse

Match, order and fix

7
Join each word to what it means.
  1. 1def
  2. 2a call
  3. 3a parameter
  4. 4lines pushed in
  • Aruns the function by its name
  • Bwrites the function down
  • Cbelong to the function
  • Da blank the call fills in
8
Put Mina's steps in order.
  • Bo spins, claps and bows
  • Run the program
  • Add the line cheer() to call it
  • Write def cheer(): with the moves pushed in
9
greet("Teo") is called. Using the same recipe as greet("Bo"), what does it say?
hi Bohi greethi Teo
10
The word inside the brackets, like "Bo" in greet("Bo"), fills in a blank called a .
parameterrecipeloop
11
Teo writes def dance(): with three moves under it and runs the program. Bo stands still. What is the mix-up to fix?
No line calls dance()The word def must be a capital letterThe moves need to be written three times
12
Think of a routine such as tidy up. Write its name and the three steps it would hold.
13
Draw a recipe card: put the function's name on top and its steps below.
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
Mina teaches Bo to cheer
1Bo does nothing, because def only writes the recipe down Def writes the recipe, and only a call runs it.
2called Def writes a function down. A call runs it.
3True Def is the recipe, and the call is the cooking.
4line 5 Line 5 is cheer() on a line of its own, not pushed in. Line 1 only writes the function.
5Three times Each call runs the function once, so three calls give three cheers.
6False The bow is written once inside cheer, so one fix changes all three cheers.
71-B, 2-A, 3-D, 4-C Def writes, a call runs, a parameter is a blank, and pushed-in lines are inside the function.
84, 3, 2, 1 First the recipe is written, then it is called, and only then does Bo cheer when the program runs.
9hi Teo Same recipe, different input, different result.
10parameter A parameter is a blank you fill in each time you call the function.
11No line calls dance() Nobody called dance, so it never ran. Add a line dance() on its own.
12Your own words: a grown-up reads it.
Mark each answer, count the right ones and write the score on the sheet.