We can join two sets like data1 and data2 using .union()
, like here data1.union(data2).
union()
gives us a new set without duplicates, even if some elements are present in both original sets, like three
here.
>>> data1 = {1,2,3}
>>> data2 = {3,4,5}
>>> data1.union(data2)
{1, 2, 3, 4, 5}