Python Programming - Sets - Discussion

Discussion Forum : Sets - General Questions (Q.No. 18)
18.
What is the purpose of the set.discard(element) method?
Removes the specified element from the set.
Removes the last element from the set.
Removes all occurrences of the specified element.
Raises a TypeError since sets are immutable.
Answer: Option
Explanation:
The discard() method removes the specified element from the set, if present.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.