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 | |
|---|---|---|
| 1a = {1,2} b = [3,4] a | b | AOutput: {1, 2, 3} | |
| 2s = {1,2,3} s.add([4,5]) | BOk: Difference {1} | |
| 3a = {1,2,3} b = {2,3,4} a & b | CError: Both must be sets for | | |
| 4a = {1,2,3} b = {2,3,4} a - b | DValid: Intersection {2, 3} | |
| 5a={1,2} b={2,3} print(a | b) | EError: Lists can't be set elements | |
| 6a={1,2} b={2,3} print(a & b) | FOutput: {2} |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Union — Combines all items from both sets with no duplicates.~~Intersectiona = {1, 2, 3}
b = {3, 4}
print(a | b)a = {1, 2, 3}
b = {2, 3, 4}
print(a & b)a = {1, 2, 3}
b = {2, 3}
print(a - b)a = {1, 2}
b = {1, 2, 3}
print(a.issubset(b))a = {1, 2, 3}
b = {2, 3, 4}
print(a ^ b)