Union combines all elements from both sets:
a = {1, 2, 3}
b = {3, 4, 5}
combined = a | b # {1, 2, 3, 4, 5}
combined = a.union(b) # Same result
The | operator and .union() method do the same thing. Elements appear once even if they were in both sets.
Think of union as "everything from either set." If you have students in class A and students in class B, the union is all students who are in at least one class.