Programming Language Python Set MCQ Question #3812
Single Choice Not Set

QWhat is the output of the following union operation
set1 = {10, 20, 30, 40}
set2 = {50, 20, "10", 60}

set3 = set1.union(set2)
print(set3)

ID: #3812 Python Set MCQ 412 views
Question Info
#3812Q ID
Not SetDifficulty
Python Set MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A {40, 10, 50, 20, 60, 30}
  • B {40,
  • C {40, 10,
  • D SynatxError: Different types cannot be used with sets
Correct Answer

Explanation

{40, 10, ’10’, 50, 20, 60, 30}

The union() method returns a new set with all items from both sets by removing duplicates

Share This Question

Challenge a friend or share with your study group.