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 | |
|---|---|---|
| 1else x > 5: print('no') | AValid: else as fallback | |
| 2else: print('no') elif x > 2: print('mid') | BOutput: small | |
| 3if x > 0: print('pos') else: print('neg') | CError: elif can't come after else | |
| 4else: print('other') | DOutput: big | |
| 5x = 2 if x > 5: print('big') else: print('small') | EError: else has no condition | |
| 6x = 8 if x > 5: print('big') else: print('small') | FOk: else with colon only |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
else — Catch-all block that runs when all if/elif conditions are False. else never has a condition - just else: with a colon.~~if/elseif x > 10:
print('Big')
else:
print('Small')if age >= 18:
print('Adult')
else:
print('Minor')if score >= 50:
print('Pass')
else:
print('Fail')if name == 'Alice':
print('Hi')
else:
print('Unknown')if temp >= 30:
print('Hot')
else:
print('Cold')