Set Methods
symmetric_difference_update()
Update the set in place with the symmetric difference of itself and another.
set.symmetric_difference_update(other)
set.symmetric_difference_update() updates the calling set in place, keeping only elements found in either set but not in both.
Parameters
| Name | Description |
|---|---|
| other | An iterable to compute symmetric difference against. |
Returns
None — modifies the set in place.
Try it
Run it and change it
data = {"a", "b", "c"}
data.symmetric_difference_update({"b", "c", "d"})
print(sorted(data))Worth knowing
- In-place operator: The
^=operator performs in-place symmetric difference update.