Frozen set methods
Creates a shallow copy of the frozenset (or set), returning a new frozenset (or set) with the same elements.
Syntax: frozensetobj2 = frozensetobj1.copy()
- Since frozenset is immutable, the copy is identical but independent (no practical difference in immutability).
- For set, the copy is mutable and can be modified independently.
Returns True if two frozenset objects (or set objects) have no common elements; otherwise, False.
Syntax: frozensetobj1.isdisjoint(frozensetobj2).
Returns True if frozensetobj1 contains all elements of frozensetobj2; otherwise, False.
Syntax: frozensetobj1.issuperset(frozensetobj2)
Returns True if all elements of frozensetobj1 are in frozensetobj2; otherwise, False.
Syntax: frozensetobj1.issubset(frozensetobj2).
Returns a new frozenset (or set) containing all unique elements from frozensetobj1 and frozensetobj2.
Syntax: frozensetobj3 = frozensetobj1.union(frozensetobj2).
Returns a new frozenset (or set) containing only the common elements between frozensetobj1 and frozensetobj2.
Syntax: frozensetobj3 = frozensetobj1.intersection(frozensetobj2).
Alternative: Use & operator (e.g., fs1 & fs2).
Returns a new frozenset (or set) containing elements in frozensetobj1 that are not in frozensetobj2.
Syntax: frozensetobj3 = frozensetobj1.difference(frozensetobj2)
Alternative: Use - operator (e.g., fs1 - fs2.
Returns a new frozenset (or set) containing elements that are in either frozensetobj1 or frozensetobj2, but not in both.
Syntax: frozensetobj3 = frozensetobj1.symmetric_difference(frozensetobj2).
Alternative: Use ^ operator (e.g., fs1 ^ fs2).