Single Choice
Not Set
QWhat is the output of the following
sampleSet = {"Yellow", "Orange", "Black"}
sampleSet.discard("Blue")
print(sampleSet)
ID: #3803
Python Set MCQ
388 views
Question Info
#3803Q 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
{‘Yellow’, ‘Orange’, ‘Black’}
If the item to remove does not exist in the set, the discard() method will NOT raise an error. If we use remove() method to perform the same operation, we will receive a keyError.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic