I want to compare 2 lists and return the matches in a list. But when I do this I don't get the matches that are identical.
matches = []
l1 = [2, 3, 4, 5, 6]
l2 = [2, 4, 4]
for n in l2:
if n in l1:
matches.append(n)
print(matches)
this returns:
[2, 4]
and what I would like it to return is:
[2, 4, 4]