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
Can use itertools.product too.
>>> common_elements=[] >>> for i in list(itertools.product(a,b)): ... if i[0] == i[1]: ... common_elements.append(i[0])