Programming Code Center(PCC)
[PYTHON]

(PCC)::[How-to-write-Python-Program-to-Illustrate-Different-Set-Operations]::[python]

File Name : Illustrate_Different_Set_Operations.py

# Program to perform different set operations like in mathematics

# define three sets
E = {0, 2, 4, 6, 8};
N = {1, 2, 3, 4, 5};

# set union
print("Union of E and N is",E | N)

# set intersection
print("Intersection of E and N is",E & N)

# set difference
print("Difference of E and N is",E - N)

# set symmetric difference
print("Symmetric difference of E and N is",E ^ N)

Output :

Illustrate_Different_Set_Operations.jpg