Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1print(scor) | ANameError: the variable was spelt score, so Python does not know scor | |
| 2print(Hello) | Bname = "Sam" print(Name) | |
| 3Capital letters matter, so Name and name are two different names | CNameError: Hello has no quotes, so Python thinks it is a variable name | |
| 4A variable must be assigned before it is used, or Python does not know it yet | Dtotal = 5 print(total) | |
| 5print(points) points = 10 | EThe variable points is used on line 1 before it is assigned on line 2, so Python raises a NameError. Assign it first, then print it. | |
| 6colour = "blue" print(colur) | FThe name is misspelt as colur, but the variable is colour. Fix the typo so both spellings match. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
NameError — An error Python raises when code uses a variable or function name it does not know, often from a typo, wrong capitals, missing quotes or using a name before it is assigned.score = 10
print(score)total = 5 + 2
print(total)Name = "Zoe"
print(Name)pet = "cat"
print("My pet is", pet)for i in range(3):
print(i)