Program to perform various operations on set.

Code:

A = {0, 2, 4, 6, 8};

B = {1, 2, 3, 4, 5};

print("Union :", A | B)

print("Intersection :", A & B)

print("Difference :", A - B)

print("Symmetric difference :", A ^ B)

A.clear()

B.clear()

print("A: ")

print("B: ")

 

Output:


Comments

Popular posts from this blog

State use of pep and pip