41. Which of the following functions cannot be used on heterogeneous sets?
42. The following Python code results in an error.
s={2, 3, 4, [5, 6]}
s={2, 3, 4, [5, 6]}
43. Which of the following is not the correct syntax for creating a set?
44. What will be the output of the following Python code?
>>> a={5,6,7,8}
>>> b={7,5,6,8}
>>> a==b
>>> a={5,6,7,8}
>>> b={7,5,6,8}
>>> a==b
45. What is the output of the following code:
set1 = {1, 2, 3}
set2 = {2, 3, 4}
print(set1.difference(set2))
set1 = {1, 2, 3}
set2 = {2, 3, 4}
print(set1.difference(set2))
46. In Python, how can you check if a set is a subset of another set?
47. What will be the output of the following Python code?
s1={1, 2, 3}
s2={4, 5, 6}
s1.isdisjoint(s2)
s2.isdisjoint(s1)
s1={1, 2, 3}
s2={4, 5, 6}
s1.isdisjoint(s2)
s2.isdisjoint(s1)
48. What will be the output of the following Python code?
>>> a={1,2,3}
>>> b=a.copy()
>>> b.add(4)
>>> a
>>> a={1,2,3}
>>> b=a.copy()
>>> b.add(4)
>>> a
49. What will be the output of the following Python code?
s=set()
type(s)
s=set()
type(s)
50. What will be the output of the following code:
my_set = {1, 2, 3}
new_set = my_set.copy()
print(new_set)
my_set = {1, 2, 3}
new_set = my_set.copy()
print(new_set)