Tutorpip← About this lessonAWith the answer keyDownload PDF
Coding · Ages 10+ · Set A
Bo's five waves
Scan to mark
on screen
A
Name
Date
Start Finish
Goal: 15 min
Score/ 11
Remember: A for loop repeats the lines pushed in under it. Range says how many turns, and lines not pushed in run just once.

Read and answer

Read the story, then answer.

One line, many wavesMina is Bo's coder, and Bo will open Friday's robot show with a wave. Mina wants five waves, but typing the same wave line five times makes her fingers ache, and one line has a typo. Ms Ola shows her a shorter way: a loop. She writes one line that starts with for, and range says how many turns there are. The wave line sits underneath, pushed in a little, so it belongs to the loop. Range of five counts zero, one, two, three and four, which is five numbers, so Bo waves five times. Mina changes only the five to an eight, and Bo waves eight times. Then she adds a bow line that is not pushed in, so it runs just once, after the last wave.
1
Bo runs this loop. How many times does he wave?
4 times5 times6 times
2
Range says how many the loop takes.
turnslinesquotes
3
A line pushed in under the for line is inside the loop.
TrueFalse
4
Mina changes only the five to an eight. How many waves now?
8 wavesStill 5 waves1 wave
5
Range of five counts one, two, three, four, five.
TrueFalse
6
How many times does the Bow line run in this show?
Four timesEight timesJust once

Match, order and fix

7
Join each piece to its job.
  1. 1for
  2. 2range
  3. 3a line pushed in
  4. 4print
  • Astarts a loop
  • Bshows a message
  • Cbelongs to the loop
  • Dsays how many turns
8
Mina gets her waves. Put the story in order.
  • Bo waves five times
  • Mina writes for and range of five
  • Ms Ola shows her a loop
  • Mina types the same wave line again and again
9
Mina wants Bo to bow just once, at the end. What is the mix-up to fix?
The bow line is pushed in, so it repeatsThe range should be oneThe wave line should not be pushed in
10
In the show program above, Bo waves and spins times each.
11
Counting every print in that show program, the screen shows messages in all.
12
Write what Mina changes so Bo waves twenty times.
13
Draw Bo's arm for each turn of range(3).
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.