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 | |
|---|---|---|
| 1s = {1, 2, 3} print(s[0]) | AError: {} creates dict, not set | |
| 2empty = {} | BError: Sets have no index | |
| 3s = {1, 2, 2, 3} | COutput: 3 | |
| 4s = set() s.add(5) | DOutput: True | |
| 5s = {3, 1, 2, 1} print(len(s)) | EValid: Becomes {1, 2, 3} | |
| 6s = {1, 2, 3} print(2 in s) | FOk: Empty set then add 5 |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Set — An unordered collection of unique items in curly braces.~~set()s = set()s = {1, 2, 3}
s.add(4)s = {1, 2, 3}
s.discard(2)print(3 in {1, 2, 3})s = {1, 2, 2, 3}
print(len(s))