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 i in range(10): | APython's version of the Scratch repeat 10 block: it repeats the indented lines 10 times | |
| 2for i in range(5): print(i) | BThe print line is not indented, so Python does not know it is inside the loop. It should be indented 4 spaces. | |
| 3A Scratch repeat 4 block with a move block inside it becomes a for loop with the move line indented underneath | Cfor i in range(4): print("move") | |
| 4A Scratch repeat 3 block with two blocks inside it becomes a for loop with both lines indented the same amount | DThe colon is missing at the end of the for line, so Python gives a syntax error. It should be for i in range(10): | |
| 5for i in range(10) print("Hi") | EPrints 0, 1, 2, 3, 4 because the counter i starts at 0 and the loop runs 5 times | |
| 6for i in range(10): print("Hi") | Ffor i in range(3): print("jump") print("spin") |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
for i in range(10): — Python's version of the Scratch repeat 10 block. The lines indented under it run 10 times, and i counts from 0 to 9.for i in range(10):
print("Jump")# Scratch: repeat 10
for i in range(10):
print("Clap")for i in range(5):
print("Step")for i in range(3):
print(i)for i in range(3):
print(i + 1)