Single Choice
Not Set
QWhat is the output of the following set operation
set1 = {"Yellow", "Orange", "Black"}
set2 = {"Orange", "Blue", "Pink"}
set3 = set2.difference(set1)
print(set3)
ID: #3799
Python Set MCQ
324 views
Question Info
#3799Q ID
Not SetDifficulty
Python Set MCQTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
{‘Pink’, ‘Blue’}
The difference() method returns a set that contains the difference between two sets.
Here set3 = set2.difference(set1) so the returned set contains items that exist only in the first set, and not in both sets.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic