union code in python code example
Example: .union in python
set1 = {2, 4, 5, 6}
set2 = {4, 6, 7, 8}
set3 = {7, 8, 9, 10}
# union of two sets
print("set1 U set2 : ", set1.union(set2))
# union of three sets
print("set1 U set2 U set3 :", set1.union(set2, set3))