I need to find the position of an index based on the existence of an value in a numerical array. I understand that I can use the .index(value) method for list but the thing is I don't want the code to exit or given None or any other type of exception if the value is not present in the array. Instead I would like to know the adjacent array indices values if the exact value is not present in the list. Hope the below example makes the problem statement clear.
arr = [10,20,30,40,50]
Input: 25
Output: 1,2
Input: 20
Output: 1
Basically the code returns the indices of the adjacent values in the array within which the search input is looked for.