set.symmetric_difference() in python
"symmetric_difference()" function is used to find the uncommon elements in the given two set.
Syntax:
set.symmetric_difference(set_value)
Example-1
n = {10, 30, 50} m = {10, 30, 100} print(n.symmetric_difference(m))
Output
{50, 100}
Example-2
n = {10, 20, 30, 40, 50} m = {10, 30} print(n.symmetric_difference(m))
Output
{40, 50, 20}
Example-3
n = {"A", "B", "C"} m = {"A", "B", "D"} print(n.symmetric_difference(m))
Output
{'C', 'D'}