71. Set members must not be hashable.
72. What will be the output of the following Python code?
a = [5,5,6,7,7,7]
b = set(a)
def test(lst):
if lst in b:
return 1
else:
return 0
for i in filter(test, a):
print(i,end=" ")
a = [5,5,6,7,7,7]
b = set(a)
def test(lst):
if lst in b:
return 1
else:
return 0
for i in filter(test, a):
print(i,end=" ")
73. What will be the output of the following code:
set1 = {1, 2, 3}
set2 = {3, 4, 5}
print(set1.intersection(set2))
set1 = {1, 2, 3}
set2 = {3, 4, 5}
print(set1.intersection(set2))
74. Which of the following functions will return the symmetric difference between two sets, x and y?
75. What is the output of the following code:
set1 = {1, 2, 3}
set2 = {3, 4, 5}
print(set1.union(set2))
set1 = {1, 2, 3}
set2 = {3, 4, 5}
print(set1.union(set2))
76. In Python, how can you create an empty set?
77. What will be the output of the following Python code?
s1={1, 2, 3}
s2={3, 4, 5, 6}
s1.difference(s2)
s2.difference(s1)
s1={1, 2, 3}
s2={3, 4, 5, 6}
s1.difference(s2)
s2.difference(s1)
78. What will be the output of the following Python code?
a={1,2,3}
b={1,2,3}
c=a.issubset(b)
print(c)
a={1,2,3}
b={1,2,3}
c=a.issubset(b)
print(c)
79. What will be the output of the following Python code?
s={1, 2, 3}
s.update(4)
s
s={1, 2, 3}
s.update(4)
s
80. What will be the output of the following Python code?
>>> a={1,2,3}
>>> b=a.add(4)
>>> b
>>> a={1,2,3}
>>> b=a.add(4)
>>> b