Definition
The symmetric_difference() method returns a set that contains all items from both set, but not the items that are present in both sets.
Syntax
set.symmetric_difference(set)
Parameters
Parameter | Description |
---|---|
set | Required. The set to check for matches in |
Examples:
persons1 = {"Mark", "Jeff", "Ivan", "Mike"}
persons2 = {"Arnel", "Marie", "Ivan", "Alex"}
persons = persons1.symmetric_difference(persons2)
print(persons)