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
If you want a boolean value:
>>> a = [1, 2, 3, 4, 5] >>> b = [9, 8, 7, 6, 5] >>> set(b) == set(a) & set(b) and set(a) == set(a) & set(b) False >>> a = [3,1,2] >>> b = [1,2,3] >>> set(b) == set(a) & set(b) and set(a) == set(a) & set(b) True