Python Set Methods
REF: https://www.programiz.com/python-programming/methods/set
Python has quite a few methods that set objects can all to perform frequency occurring task (related to set). For example, if you want to find intersection of two sets, you can use intersection()
method.
The page contains all methods of set objects. Also, the page includes built-in functionsthat can take set as a parameter and perform some task.
Search Set Method
Method | Description |
---|---|
Python Set remove() | Removes Element from the Set |
Python Set add() | adds element to a set |
Python Set copy() | Returns Shallow Copy of a Set |
Python Set clear() | remove all elements from a set |
Python Set difference() | Returns Difference of Two Sets |
Python Set difference_update() | Updates Calling Set With Intersection of Sets |
Python Set discard() | Removes an Element from The Set |
Python Set intersection() | Returns Intersection of Two or More Sets |
Python Set intersection_update() | Updates Calling Set With Intersection of Sets |
Python Set isdisjoint() | Checks Disjoint Sets |
Python Set issubset() | Checks if a Set is Subset of Another Set |
Python Set issuperset() | Checks if a Set is Superset of Another Set |
Python Set pop() | Removes an Arbitrary Element |
Python Set symmetric_difference() | Returns Symmetric Difference |
Python Set symmetric_difference_update() | Updates Set With Symmetric Difference |
Python Set union() | Returns Union of Sets |
Python Set update() | Add Elements to The Set. |
Python any() | Checks if any Element of an Iterable is True |
Python all() | returns true when all elements in iterable is true |
Python ascii() | Returns String Containing Printable Representation |
Python bool() | Converts a Value to Boolean |
Python enumerate() | Returns an Enumerate Object |
Python filter() | constructs iterator from elements which are true |
Python frozenset() | returns immutable frozenset object |
Python iter() | returns iterator for an object |
Python len() | Returns Length of an Object |
Python max() | returns largest element |
Python min() | returns smallest element |
Python map() | Applies Function and Returns a List |
Python set() | returns a Python set |
Python sorted() | returns sorted list from a given iterable |
Python sum() | Add items of an Iterable |
Python zip() | Returns an Iterator of Tuples |