Login and Register ×
Check your Email for the OTP
Python Programming Language MCQ Python Set MCQ
⚠ Report ✓ Question Verified Copy Link
sampleSet = {"Yellow", "Orange", "Black"} sampleSet.discard("Blue") print(sampleSet)
Explanation:
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.
discard()
remove()
keyError
Related Topic:
Share Above MCQ
Learn More MCQ Questions from Python Programming Language MCQ Python Set MCQ