Method Signature
symmetric_difference(anotherSetObject_in)
Overview
A difference set is returned - with elements that are present in either of the sets.
However the elements that are present in both the sets will be excluded.
Parameters
anotherSetObject_in: The set to be compared to produce the difference set.
Example
# Example Python program that finds the symmetric difference
# between two sets
sportList1 = {"Football", "Golf", "Hockey", "Polo", "Tennis"}
sportList2 = {"Carrom", "Table tennis", "Chess", "Tennis"}
# Find the symmetric difference
symDiff = sportList1.symmetric_difference(sportList2)
print(symDiff)Output
{'Carrom', 'Table tennis', 'Golf', 'Football', 'Chess', 'Hockey', 'Polo'}