Say I have a list v = [1, 2, 3, 4, 3, 1, 2]
. I want to write a function, find_pair
which will check if two numbers are in the list and adjacent to each other. So, find_pair(v, 2, 3)
should return True
, but find_pair(v, 1, 4)
should return False
.
Is it possible to implement find_pair
without a loop?