I want to find the first index in A
that contains a value from B
. For example:
A = [1, 'Q', 3, 6, 'R']
B = ['Z', 'I', 'O', 3]
A.function(B) # would return 2
Is there a simple way of doing this? Obviously you can search through A
for each item in B
and take the minimum index, but this is slower than trying all of B
for each index.