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 | |
|---|---|---|
| 1while x < 10 x += 1 | AOutput: 8 | |
| 2i = 0 while i < 5: print(i) | BOk: Infinite loop with break | |
| 3i = 0 while i < 3: i += 1 | CValid: Loop runs 3 times | |
| 4while True: if done: break | DOutput: 1 2 3 | |
| 5i = 1 while i <= 3: print(i) i += 1 | EError: Infinite loop — never increments i | |
| 6x = 10 while x > 8: x -= 1 print(x) | FError: Missing colon after while |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
while — Repeats indented code as long as the condition is True.~~Conditioni = 0
while i < 5:
print(i)
i = i + 1i = 0
while i < 5:
print(i)
i = i + 1i = 0
while i < 5:
print(i)
i = i + 1i = 0
while i < 5:
print(i)
i = i + 1count = 3
while count > 0:
print(count)
count = count - 1