Programming Language › Python Set MCQ › Question #3811
Single Choice Not Set

QWhat is the output of the following set operation.
set1 = {"Yellow", "Orange", "Black"}
set2 = {"Orange", "Blue", "Pink"}

set1.difference_update(set2)
print(set1)

ID: #3811 Python Set MCQ 359 views
Question Info
#3811Q ID
Not SetDifficulty
Python Set MCQTopic

Choose the Best Option

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

  • A { ✔ ✖
  • B { ✔ ✖
Correct Answer

Explanation

{‘Black’, ‘Yellow’}

The difference_update() method removes the items that exist in both sets. Here set1.difference_update(set2) removed the unwanted items from the original set1.

Today: 0 answered · 0 correct
Save progress
Free account

Want to remember what you got wrong?

Create a free account in seconds to track your score, revisit mistakes and continue Programming Language where you left off.

  • Save your progress & streak
  • Topic-wise quizzes & scores
  • Bookmark tricky questions
  • Printable MCQ sets
Practice smarterFree account · save progress
Sign up free

Share This Question

Challenge a friend or share with your study group.