Folks familiar with mathematics will know that sets have three main operations, union, intersection, and difference.
The set data structure in Python supports all three.
Union
A union of two sets is the collection of all unique elements from both sets.
widget
In Python, union can be performed using either the pipe operator, |, or the union() method: