Choose the correct output of the following Python code from the given options.
set1 = set()
set2 = set()
for i in range(2, 6):
set1.add(i)
for i in range(4, 7):
set2.add(i)
print("Set1 = ", set1)
print("Set2 = ", set2)
set3 = set1 | set2
set4 = set1 & set2
print(set4)
if set3 > set4:
print("0")
elif set3 < set4:
print("2")
else :
print("1")
if set4 < set3:
print("0")
set5 = set3 - set4
print(set5)
if set4.isdisjoint(set5):
print("1")
set5.clear()
print(set5)
Correct Answer:
Set1 = {2, 3, 4, 5}
Set2 = {4, 5, 6}
{4, 5}
0
0
{2, 3, 6}
1
set()
Explanation:
Note: This Question is unanswered, help us to find answer for this one
More Python MCQ Questions