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 2023 © pythontic.com