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 | |
|---|---|---|
| 1elif Move == "B": | Aif Move == "F": | |
| 2else: | BTests the next CASE value after the first, like the line B: in a CASE OF Move statement | |
| 3The first value in CASE OF Move becomes an if that tests the variable Move | CThe second value uses if instead of elif, so it is a separate test and not part of the same chain. It should be elif Move == "B": | |
| 4Every value in the chain tests the same variable, so each elif compares Move again | DOTHERWISE does not exist in Python. The catch-all branch must be written as else: | |
| 5if Move == "F": print("Forward") if Move == "B": print("Back") | Eelif Move == "L": | |
| 6elif Move == "B": print("Back") OTHERWISE: print("Invalid") | FRuns when none of the if or elif tests match, just like OTHERWISE in a CASE statement |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
if/elif/else — Python has no CASE, so write it as an if/elif chain testing the same variable. The first value uses if, each other value uses elif, and OTHERWISE becomes else.if move == "L":
print("Left")
elif move == "R":if move == "L":
print("Left")
elif move == "R":elif move == "R":
print("Right")
else:if move == "L":
print("Left")
elif move == "R":if move == "L":
print("Left")
elif move == "R":