Home >>Python Set Methods >Python Set symmetric_difference() Method
Python set symmetric_difference() method is used to return a set that contains all the items from both set but not the items that are present in both the sets.
Syntax:set.symmetric_difference(set)
Parameter | Description |
---|---|
set | This is a required parameter. It defines the set to check for matches in. |
x = {"Abhi", "Jerry", "Mickey"}
y = {"Wings", "Alpha", "Jerry"}
z = x.symmetric_difference(y)
print(z)
x = {"Abhi", "Jerry", "Mickey"}
y = {"Wings", "Alpha", "Jerry"}
z = y.symmetric_difference(x)
print(z)