Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (13 sloc) 323 Bytes
def intersect(xs, ys):
snd = dict()
for y in ys:
snd[y] = "whatever"
matches = []
for x in xs:
if x in snd.keys():
matches.append(x)
return matches
if __name__ == "__main__":
a = [1, 5, 6, 8, 9, 15]
b = [2, 3, 4, 5, 9, 20, 31, 33, 34]
print intersect(a, b)