DEV Community

Tommi k Vincent
Tommi k Vincent

Posted on

Union of Sets in python.

Union of sets is the process of combining two existing sets to become distinct Set Object. Enter the following code into a python file and see the output.

First11 = set(["Sanchez","Reece James","Levi colwil","Thiago Silva","Cucurella","Caicedo","Enzo Fernandez","Callagher","sterling","Palmer","Mudryk"])
Substitutes  = set(["Deivid","Madueke","Disasi","Malo-Gusto","Badiashile","Pektovic"])



chelsea =  First11|Substitutes

print(chelsea)
Enter fullscreen mode Exit fullscreen mode

output
When the above code is executed, it produces the following result

{'Malo-Gusto', 'Enzo Fernandez', 'Disasi', 'Madueke', 'Badiashile', 'Pektovic', 'Cucurella', 'Thiago Silva', 'Reece James', 'Sanchez', 'sterling', 'Callagher', 'Palmer', 'Mudryk', 'Deivid', 'Caicedo', 'Levi colwil'}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)