Different Set Operations

A = {1,2,3,4,5,6,7,8};
B = {5,10,15,20,25,30,35,40};
   
print("Union of A and B is",A | B)

print("\nIntersection of A and B is",A & B)

print("\nDifference of A and B is",A - B)

print("\nSymmetric difference of A and B is",A ^ B)

No comments: