Since sets are similar to dictionaries, they have a number of methods associated with them, which apply to both set and frozenset:
- len(s): This returns the number of items in set s
- x in s: This returns True if x exists in s; otherwise, it is False
- x not in s: This returns False if x exists in s; otherwise, it is True
- isdisjoint(other): This returns True if the set has no elements in common with object other
- issubset(other): This tests whether all elements in the set are also in other
- issuperset(other): This tests whether all elements in other are also in set
- union(*others): This returns a new set that includes elements from the original set and all other objects
- intersection(*others): This returns a new set that only contains objects ...