in Python find number of same elements in 2 lists
- by John
Hi,
In Python if I have 2 lists say:
l1 = ['a', 'b', 'c', 'd']
l2 = ['c', 'd', 'e']
is there a way to find out how many elements they have the same. In the case about it would be 2 (c and d)
I know I could just do a nested loop but is there not a built in function like in php with the array_intersect function
Thanks