-
a = {1, 2, 3, 2, 3, 4, 4, 5} print(a) # {1, 2, 3, 4, 5} print(type(a)) # <class 'set'> b = {2, 3, 7} c = a - b print(c) # {1, 4, 5} print(a) # {1, 2, 3, 4, 5} print(b) # {2, 3, 7} c = a & b print(c) # {2, 3} 교집합 c = a | b print(c) # {1, 2, 3, 4, 5, 7} 합집합 c = a ^ b print(c) # {1, 4, 5, 7} 대칭 차집합 #################################################################### s = {1, 2, 3, 4, 5} s.add(6) print(s) # {1, 2, 3, 4, 5, 6} s.remove(6) print(s) # {1, 2, 3, 4, 5} l = [1, 2, 2] x = set(l) print(x) # {1, 2}