I want to take two lists and find the values that appear in both.
a = [1, 2, 3, 4, 5] b = [9, 8, 7, 6, 5] returnMatches(a, b)
would return
>>> s = ['a','b','c'] >>> f = ['a','b','d','c'] >>> ss= set(s) >>> fs =set(f) >>> print ss.intersection(fs) **set(['a', 'c', 'b'])** >>> print ss.union(fs) **set(['a', 'c', 'b', 'd'])** >>> print ss.union(fs) - ss.intersection(fs) **set(['d'])**