Built-in Set Functions in Python
The following table lists all the functions that can be used with the set type in Python 3.
|Adds an element to the set. If an element is already exist in the set, then it does not add that element.
|Removes all the elements from the set.
|Returns a shallow copy of the set.
|Returns the new set with the unique elements that are not in the another set passed as a parameter.
|Updates the set on which the method is called with the elements that are common in another set passed as an argument.
|Removes a specific element from the set.
|Returns a new set with the elements that are common in the given sets.
|Updates the set on which the instersection_update() method is called, with common elements among the specified sets.
|Returns true if the given sets have no common elements. Sets are disjoint if and only if their intersection is the empty set.
|Returns true if the set (on which the issubset() is called) contains every element of the other set passed as an argument.
|Removes and returns a random element from the set.
|Removes the specified element from the set. If the specified element not found, raise an error.
|Returns a new set with the distinct elements found in both the sets.
|Updates the set on which the instersection_update() method called, with the elements that are common among the specified sets.
|Returns a new set with distinct elements from all the given sets.
|Updates the set by adding distinct elements from the passed one or more iterables.