This method is used to return items that are left behind after the intersection of two sets. This method returns the item into the third variable.
Variable = A.symmetric_difference(B).
This method takes an argument.
- Set A is being taken with some random values
- Set B is being taken with some random values
- symmetric_difference() method is being applied on set A with set B.
- Output is printed into C variable
- Output is elements that are left after the intersection of two sets.
- What is the difference between difference() method and symmetric_difference() method?
The difference() method returns an item that is only present in the first set and not the second, whereas the symmetric_difference method returns an item that is not present in both sets.