-
Write a
for
loop that prints the elements in set s1.
for element in s1:
print(element)
-
Write a Python expression to see if the set s1
contains 5.
5 in s1
-
Write a Python expression to see if the set s1
DOES NOT contain 12.
12 not in s1
-
Write a Python expression that returns the union of the sets
A and B.
A.union(B) or B.union(A)
-
Write a Python expression that returns the intersection of the sets
A and B.
A.intersection(B) or B.intersection(A)
-
Write a Python expression that returns the difference between the sets
A and B.
A.difference(B) or A - B
-
Is the difference between the sets A and
B the same as the difference between the sets
B and A
no
-
What does the clear method do?
removes all elements from a set
-
Write a Python expression that returns the largest element in the set A.
max(A)
-
Write a Python expression that returns the smallest element in the set A.
min(A)