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 | |
|---|---|---|
| 1t = (1) | AValid: Tuple with three items | |
| 2t[0] = 5 | BOk: Unpack a tuple into two variables | |
| 3t = (1, 2, 3) | COutput: 4 | |
| 4a, b = (10, 20) | DError: Single item needs trailing comma: (1,) | |
| 5(1, 2, 3)[1] | EError: Tuples are immutable — cannot assign | |
| 6len((4, 5, 6, 7)) | FOutput: 2 |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Tuple — An immutable ordered sequence created with parentheses.~~Immutablepoint = (3, 4)
print(point[0])single = (42,) # single-item tuplea, b = (10, 20)
print(b)t = (1, 2, 3)
print(len(t))print(2 in (1, 2, 3))