Set operations on unique letters from two words
a = set('abracadabra')
b = set('alacazam')
print a # unique letters in a
set(['a', 'r', 'b', 'c', 'd'])
print a - b # letters in a but not in b
print a | b # letters in either a or b
print a & b # letters in both a and b
print a ^ b # letters in a or b but not both
Related examples in the same category