A set is a collection of distinct objects.
A row of houses, a herd of cows, the planets of solar family are some examples of a set.
A python Set is a collection of unique elements and not sorted by default.
The set data structure in Python provides operations to
- Check a whether a set is a subset of another set
- Check a whether a set is a superset of another set
- Determine whether two sets or disjoint
- Get the intersection set of two sets
- Get the difference set of two sets
- Get the symmetric difference of two sets
- Create a Union of Two Sets
How to construct set objects in python, the list of methods along with their method signatures
and example usage of each method for the Python set objects are described here.
Set Construction
issubset
issuperset
union
intersection
difference
symmetric_difference
add
remove
discard
pop
copy
clear
len
element in set
element not in set