# Python Program to Find Different Set of Mathematical Operations

## Find Different Set of Mathematical Operations in Python

To find different set of mathematical operations in python such as union, intersection, difference, symmetric difference, you have to choose two set of numbers and perform the desired operations as shown in the program given here.

## Python Programming Code to Find Different Set of Mathematical Operations

Following python program choose two set of numbers and then find the different set of mathematical operations:

```# Python Program - Find Different Set of Mathematical Operations

A = {0, 2, 4, 6, 8}
B = {1, 2, 3, 4, 5}
print("If A = {0, 2, 4, 6, 8}");
print("and B = {1, 2, 3, 4, 5}");
print("Then,");
print("Union of A and B =", A | B)
print("Intersection of A and B =", A & B)
print("Difference of A and B =", A - B)
print("Symmetric difference of A and B =", A ^ B)
```

Union of two set (A and B) can be calculated as all the elements from both the set without repeating any element say A | B will be 0, 1, 2, 3, 4, 5, 6, 8.

Intersection of two set (A and B) can be calculated as all the common elements from both the set say A & B will be 2, 4 as both the element is present in both the set.

Difference of two set (A and B) can be calculated as all those elements that are present in set A but not in set B say A - B will be 0, 6, 8 as both the elements are present in set A but not in B.

Symmetric difference of two set (A and B) can be calculated as all the unique elements from both the set say A ^ B will be 0, 1, 3, 5, 6, 8 as these elements are present in either of the two set but not in both the set.

Here is the sample run of the above Python program: Same program on python shell: Tools
Calculator