Tutorpip← About this lessonAHide the answer keyDownload PDF
Coding · Ages 10+ · Set A
An error message is a clue
Scan to mark
on screen
A
Name
Date
Start Finish
Goal: 15 min
Score/ 11
Remember: An error message is a clue. Read the last line, find the line number, look at that line, change one thing, and run it again.

Read and answer

Read the story, then answer.

Ten minutes to the showTen minutes before the show, Mina presses Run and Bo's screen fills with a long message. She groans that she broke it. Ms. Ola says an error message is not a telling-off. It is a clue from the computer that says what happened and where. Mina reads the last line, which says Name error, and the line number, which says line three. On line three she typed cont, but the name she meant was count. She adds the missing letter and runs it again, and Bo wakes up and waves. Ms. Ola gives her a plan: read, find, look, change, run.
1
Mina gets a long error message. Where does she read first?
The top lineThe middleThe last line
2
An error message means Mina broke the computer.
TrueFalse
3
The last line of an error message names the kind of .
gamecolorproblem
4
Mina asks for box three in her list of three snacks. What does Python say?
NameErrorIndexError: there is no box threeSyntaxError
5
Mina fixes her program. Put what she does in order.
  • Run it again
  • Look at line three and see cont
  • Find the line number: line three
  • Read the last line: NameError
  • Add the missing letter to make count
6
The line number in an error message says where to look.
TrueFalse

Match, order and fix

7
Join each error to what it means.
  1. 1NameError
  2. 2SyntaxError
  3. 3IndexError
  4. 4IndentationError
  5. 5TypeError
  • Atwo kinds of things were mixed, like text and a number
  • Bthe list has no box with that number
  • Ca line is not pushed in the way it should be
  • Da line has a piece missing or extra
  • Ethe computer cannot find a name
8
Teo's for line is missing its colon. Which kind of error does Python name?
IndexErrorNameErrorSyntaxError
9
An error message pops up. Circle every good thing to do.
Read the last lineChange five things at onceFind the line numberClose the laptop and give up
10
After you change one thing, you the program again to see if it works.
deleterunhide
11
A list of three boxes has the last box numbered .
12
A friend says "I broke it!" when an error message pops up. Write what you would tell them.
13
Draw a card with Ms. Ola's plan: read, find, look, change, run.
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
An error message is a clue
1The last line The last line names the kind of problem.
2False An error message is a clue from the computer. Nothing is broken.
3problem It names the kind of problem, such as a NameError.
4IndexError: there is no box three Boxes count from zero, so a list of three has boxes 0, 1 and 2. There is no box three.
55, 3, 2, 1, 4 Read, find, look, change, run: the last line says what, and the line number says where.
6True It says where the computer got stuck.
71-E, 2-D, 3-B, 4-C, 5-A Each error has a job to say in plain words, and the name is the first clue.
8SyntaxError Syntax is how a line is written. A missing colon is a piece missing.
9Read the last line, Find the line number Read the last line and find the line number. Change just one thing so you know what helped.
10run Run it again: it works, or you get a new clue.
112 The boxes are numbered 0, 1 and 2.
12Your own words: a grown-up reads it.
Mark each answer, count the right ones and write the score on the sheet.