Home >>Python Set Methods >Python Set symmetric_difference_update() Method
Python set symmetric_difference_update() method is used to update the given input set by removing all the items that are present in both sets and inserting the other items within the set that aren't present.
Syntax:
set.symmetric_difference_update(set)
Parameter | Description |
---|---|
set | This is a required parameter. It defines the set to check for matches in. |
Here is an example of Python symmetric_difference_update() method:
x = {"Abhi", "Jerry", "Mickey"}
y = {"Wings", "Alpha", "Jerry"}
x.symmetric_difference_update(y)
print(x)
Example 2:
x = {"Abhi", "Jerry", "Mickey"}
y = {"Wings", "Alpha", "Jerry"}
y.symmetric_difference_update(x)
print(y)