Tutorpip← About this lessonAHide the answer keyDownload PDF
Coding · Ages 10+ · Set A
Mina's snack list
Scan to mark
on screen
A
Name
Date
Start Finish
Goal: 15 min
Score/ 11
Remember: A list keeps many things in numbered boxes, and the first box is zero. Len counts the boxes, and append adds one at the end.

Read and answer

Read the story, then answer.

The snack boxesMina keeps four snacks in a Python list called snacks: mango, pear, plum and fig. Each snack sits in its own numbered box, and Python starts counting the boxes at zero, not one. So the mango is in box zero and the pear is in box one. Asking for box three gives the fig. The command len counts the boxes, and it says four. Then Teo brings a kiwi. The command append adds one thing at the end, so the kiwi lands in box four and len says five. A for loop can visit every box, and it takes only two lines.
1
Which snack is in box two?
🍐pear🍑plum🟣fig
2
Python starts counting the boxes at .
zeroonetwo
3
Mina's list has four boxes. What is the number of the last one?
435
4
A list with four things has the boxes numbered 1, 2, 3 and 4.
TrueFalse
5
Teo brings a kiwi, and append adds it. Where does it go?
Into box zero, at the startIn the middle, between the pear and the plumInto box four, at the end
6
A list with seven things in it makes len say .

Match, order and fix

7
Join each word to its job.
  1. 1square brackets
  2. 2len
  3. 3append
  4. 4a for loop
  • Avisits every box
  • Badds one box at the end
  • Chold the things in a list
  • Dcounts the boxes
8
The kiwi is added with append. Put the five snacks in box order, box zero first.
  • pear
  • fig
  • kiwi
  • mango
  • plum
9
Teo says the last of five boxes is box five. What is the mix-up to fix?
Boxes start at zero, so the last of five boxes is box fourAppend puts the kiwi firstLen would say four
10
A for loop can visit every box in a list.
TrueFalse
11
Mina's list is mango, pear, plum, fig. Which line asks for the plum?
snacks[3]snacks[1]snacks[2]
12
Write four things you like, one in each box, and number the boxes from zero.
13
Draw four boxes and number them from zero. Write a different snack in each.
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's snack list
1plum Counting starts at zero: mango is box 0, pear is box 1 and plum is box 2.
20 The first box is box zero, no steps from the start.
33 The boxes are 0, 1, 2 and 3, so the last box is three, three steps from the start.
4False The boxes are numbered 0, 1, 2 and 3.
5Into box four, at the end Append adds one thing at the end, so the kiwi lands in box four.
67 Len counts the boxes, so seven things make len say seven.
71-C, 2-D, 3-B, 4-A Brackets hold the list, len counts, append adds, and a for loop visits each box.
82, 4, 5, 1, 3 Box 0 is the mango, then the pear, plum and fig, and append put the kiwi in the last box.
9Boxes start at zero, so the last of five boxes is box four Counting starts at zero, so five boxes are numbered 0 to 4. The count is one more than the last box number.
10True Even a hundred snacks would need only two lines.
11snacks[2] The plum is in box two, and the box number goes in square brackets.
12Your own words: a grown-up reads it.
Mark each answer, count the right ones and write the score on the sheet.