Count duplicates between 2 lists
Shorter way and better: >>> a = [1, 2, 9, 5, 1] >>> b = [9, 8, 7, 6, 5] >>> len(set(a) & set(b)) # & is intersection – elements common to both 2 Why your code doesn’t work: >>> def filter_(x, y): … count = 0 … for num in y: … if num … Read more