The symmetric_difference() method returns a new set which consists of the symmetric difference of two given sets.
Example
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
A = {1,4,5,6,11}
B={1,5,6,7,9,11,12}
C={22,1,34,4}
print(A.symmetric_difference(B))
print(B.symmetric_difference(C))
Output:
{4, 7, 9, 12}
{34, 4, 5, 6, 7, 9, 11, 12, 22}
Syntax
set_x.symmetric_difference(set_y)
Parameters
set_x and set_y are two sets
Return Value
It returns a new set which is the symmetric difference of sets set_x and set_y.