Source Code:
(back to article)
set1 = {1, 2, 3} set2 = {2, 3, 4} # Union print(set1.union(set2)) # {1, 2, 3, 4} # Intersection print(set1.intersection(set2)) # {2, 3} # Difference print(set1.difference(set2)) # {1}
Result:
Report an issue