operation set creation complexity ( set creation ( cardinality membership ( ( nonmembership disjoint ( subset (nsuperset (nunion (nintersection (nset difference (nsymmetric difference set copy (no(no(nusage =set([iterable]description calls the set constructor to create set iterable is an optional initial contents in which case we have (ncomplexity =frozenset([iterable]calls the frozenset constructor for immutable set objects to create frozenset object len(sthe number of elements in is returned in returns true if is in and false otherwise not in returns true if is not in and false otherwise isdisjoint(treturns true if and share no elementsand false otherwise issubset(treturns true if is subset of tand false otherwise issuperset(treturns true if is superset of and false otherwise union(treturns new set which contains all elements in and intersection(treturns new set which contains only the elements in both and difference(treturns new set which contains the elements of that are not in symmetric_difference(treturns new set which contains difference(tunion( difference( ) copy(returns shallow copy of fig set and frozen set operations sets are objects that have several commonly defined operations on them these operations are sometimes binary operations involving more than one setand sometimes retrieve information about just one set the table in fig describes commonly defined operations on sets and their associated computational complexities python has built-in support for two types of setsthe set and frozenset classes the frozenset class is immutable objects of the set class can be mutated in fig the variable must be set and the variable must be an iterable sequencewhich would include sets infix operators are also defined as syntactic sugar for some of the operations defined in fig for subset containment you can write < for proper subset you can write proper subset is subset that has at least one less element than its superset for superset you can write > or for proper superset for the union operationwriting is equivalent to writing union(tand for intersections& is equivalent to writing intersection(twriting is the same as writing difference(tand ^ is equivalent to the symmetric difference operator the operations in fig are not defined on the frozenset class since they mutate the set they are only defined on the set class againthere are operators for some of the methods presented in fig the mutator union method can be written |= intersection update can be written as &= finallythe symmetric difference update operator is written ^= while these operators are convenientthey are not well-known and code written by calling the methods in the table above will be more descriptive this copy belongs to 'acha