I've got listA
, which contains
[0, 20, 40, 60, 80, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 340]
and listB
, which contains
[87, 78343, 100, 38, 100, 20, 80]
I'd like to be able to be able to find the index of the numbers in listA
which are also in listB
.
For example, listA
and listB
share 100, 100, 20, and 80. The index of these integers in listA
is
[6, 6, 1, 4, 5]
Is there a process that will find this for me so I don't have to do it by hand?
This is similar to this question. The difference is that I have to know the index even when it occurs multiple times in either list, while the answer at that link only works on the first example of the instance: i.e. 80 in listB
is at [4] and [5] on listA
, but the method described would only return [4].