Python set symmetric_difference() method
Return the items in exactly one of the two sets.
Syntax
set.symmetric_difference(other) / a ^ b
Parameters
| other | the other set |
Return value
a new set
Example
Code
a = {1, 2, 3} b = {3, 4} print(a ^ b)
Output
{1, 2, 4}
Related
Learn it step by step in the free lesson Dictionaries & Sets, with exercises that check your answers.