out[ ]set([ ]sets support mathematical set operations like unionintersectiondifferenceand symmetric difference see table - for list of commonly used set methods in [ ] { in [ ] { in [ ] union (orout[ ]set([ ]in [ ] intersection (andout[ ]set([ ]in [ ] difference out[ ]set([ ]in [ ] symmetric difference (xorout[ ]set([ ]you can also check if set is subset of (is contained inor superset of (contains all elements ofanother setin [ ]a_set { in [ ]{ issubset(a_setout[ ]true in [ ]a_set issuperset({ }out[ ]true as you might guesssets are equal if their contents are equalin [ ]{ ={ out[ ]true table - python set operations function alternate syntax description add(xn/ add element to the set remove(xn/ remove element from the set union(ba all of the unique elements in and intersection(ba all of the elements in both and difference(ba the elements in that are not in symmetric_difference(ba all of the elements in or but not both issubset(bn/ true if the elements of are all contained in issuperset(bn/ true if the elements of are all contained in isdisjoint(bn/ true if and have no elements in common data structures and sequences www it-ebooks info