This method is used to return a set which has common items in them, if there are no common items it returns an empty set.
Also, this method can take multiple sets as argument, meaning we can find intersection of n numbers of sets with this method.
For two set intersection
Variable = A.intersection(B)
For two or more set intersection
Variable = A.intersection(B,C,D,E)
This method takes an arguments
- Set A is taken
- Set B is taken
- intersection() method is applied on set A with B
- output is taken into third variable
- output is printed
- The common item from intersection of set A and B is printed