set symmetric difference

  • set
  • symmetric_difference


examples/sets/difference.py

english = set(['door', 'car', 'lunar', 'era'])
spanish = set(['era', 'lunar', 'hola'])

diff = english.symmetric_difference(spanish)
print('symmetric_difference: ', diff)
  • Symmetric difference contains all the elements in either one of the sets, but not in both. "the ears of the elephant".
symmetric_difference:  {'door', 'hola', 'car'}