& Intersection | union - set difference ^ exclusive or set
# When the collection operation do not affect the original set, but returns a result of the operation # Create two sets S = {1,2,3,4,5 } S2 = {3,4,5,6, 7 } # & intersecting operation result S = S2 & # {. 3,. 4,. 5} # | union operation result S = | S2 # {1,2,3,4,5,6,7} # - set difference result S = - S2 # {. 1, 2} # ^ acquired set of exclusive oR elements only appear in one collection Result S ^ S2 = # {. 1, 2,. 6,. 7} # <= checks whether the set is a collection of another subset # If all of a set of elements are present in the set b, then a set is a subset of the set of b, b collection is a superset of the set of a = {l, 2,3 } b = {1,2 , 3,4,5 } the ResultA = <= B # True Result = {l, 2,3} <= {l, 2,3} # True Result = {1,2,3,4,5} <= {l, 2,3} # false # <checks whether the set is a subset of another set # element superset if b contains a subset of all the elements, a and b are not there, then b is a superset of the set, is a b proper subset Result = {l, 2,3} <{l, 2,3} # False Result = {l, 2,3} <{1,2,3,4,5} # true # > = check whether a set of other superset # > check whether the set is a superset of another real Print ( ' Result = ' , Result)