Common elements between two lists not using sets in Python

Posted by Thomas on Stack Overflow See other posts from Stack Overflow or by Thomas
Published on 2010-04-28T07:53:24Z Indexed on 2010/04/28 8:23 UTC
Read the original article Hit count: 346

Filed under:
|
|
|
|

I want count the same elements of two lists. Lists can have duplicate elements, so I can't convert this to sets and use & operator.

a=[2,2,1,1]
b=[1,1,3,3]

set(a) & set(b) work
a & b don't work

It is possible to do it withoud set and dictonary?

© Stack Overflow or respective owner

Related posts about python

Related posts about list