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 | |
|---|---|---|
| 1if score > 10: | AThis line is indented 4 spaces, so it is inside the block above it. | |
| 2 print("Hi") | BThe line after the colon is not indented, so it is not inside the block. Indent it by 4 spaces. | |
| 3Every line inside a block is indented by the same amount, usually 4 spaces | Cfor i in range(3): print(i) print(i * 2) | |
| 4The block ends when the indent ends, so the next unindented line runs after the block | Dwhile x < 3: x = x + 1 print("Done") | |
| 5if age >= 13 print("Teen") | EThe if line is missing the colon at the end, so Python does not know a block is starting. Add : after the condition. | |
| 6for i in range(3): print(i) | FThe colon at the end of the line starts a block. The indented lines under it belong to the if. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
: — A colon at the end of a line starts a block. The lines inside the block are indented by the same amount (4 spaces), and the block ends when the indent ends.if age >= 13:
print("Teen")for i in range(3):
print(i)while count < 3:
print(count)
count = count + 1def greet(name):
print("Hi " + name)
greet("Mia")for i in range(2):
print(i)
print("Finished")