Python - set symmetric_difference()


Python tip:

You can use .symmetric_difference() to get a new set containing elements that are either in the first or second set but not in both.

For example:

winners = {"John", "Marry"}
players = {"Daisy", "John", "Bob"}

print(players.symmetric_difference(winners))
# => {'Bob', 'Daisy', 'Marry'}