DEV Community

I'm Just a Guy with a Computer
I'm Just a Guy with a Computer

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)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more