Python - Set Methods


Set Methods

Python has a set of built-in methods that you can use on sets.

Method Description
Adds an element to the set
Removes all the elements from the set
Returns a copy of the set
Returns a set containing the difference between two or more sets
Removes the items in this set that are also included in another, specified set
Remove the specified item
Returns a set, that is the intersection of two other sets
Removes the items in this set that are not present in other, specified set(s)
Returns whether two sets have a intersection or not
Returns whether another set contains this set or not
Returns whether this set contains another set or not
Removes an element from the set
Removes the specified element
Returns a set with the symmetric differences of two sets
inserts the symmetric differences from this set and another
Return a set containing the union of sets
Update the set with the union of this set and others


Login
ADS CODE