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 case it will be 2 (c and d)
I know that I can just execute a nested loop, but there is no built-in function, e.g. in php with array_intersect function
thanks
source share