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 | |
|---|---|---|
| 1for pet in pets: | AThe if line is not indented, so it is not inside the loop. It needs 4 spaces before it. | |
| 2for score in scores: if score > 50: | BRuns the indented block once for each value in the list pets, with pet holding the current value each time | |
| 3The item variable holds the current value from the list each time round the loop | CLoops through every score in the list and uses an if to check each one against 50 | |
| 4Looping with an if inside only counts the items that pass the test | DThe first line is missing the colon at the end. It should be for fruit in fruits: | |
| 5for fruit in fruits print(fruit) | Efor age in ages: if age >= 13: count = count + 1 | |
| 6for mark in marks: if mark > 50: print(mark) | Ffor name in names: print(name) |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
for item in my_list: — Runs the indented block once for each value in the list. The variable item holds the current value each time round, starting with the first and finishing with the last.for item in my_list:
print(item)for item in my_list:
print(item)for fruit in fruits:
print(fruit)for mark in marks:
if mark >= 50:
print(mark)for n in numbers:
if n > 10:
print(n)