Python Set - symmetric_difference method

Method Name: symmetric_difference(anotherSetObject_in)

Method Overview:

A difference set is returned - with elements that are present in either of the sets.
But, the elements that re present in both the sets will be excluded.

Parameters:


anotherSetObject_in : The set to be compared to produce the difference set.

Exceptions:

None
 

>>> SportList1 = {"Football","Golf","Hockey","Polo","Tennis"}

>>> SportList2 = {"Carrom","Table Tennis","Chess","Tennis"}

>>> SportList1.symmetric_difference(SportList2)

{'Golf', 'Chess', 'Polo', 'Carrom', 'Football', 'Table Tennis', 'Hockey'}


Copyright 2024 © pythontic.com