I am using Python 3 and I have this problem:
ListA = [38,40,27,11,1,5,22,7,47,3,11]
ListB = [12,16,38,5,40,27,3]
I need to count how many times in a row any numbers from ListB
appeared in ListA
.
The output, in this case, should be 3
.
Because 38, 40 and 27 are numbers that are in ListB
, and are first 3 numbers in ListA
.
In case of no matches (if the first number in ListA
is not in ListB
), the output should be: 0
.