please help I've been trying to implement this linear_search algorithm in python but is not working. when i type in the first element in the array i get a True, but when i type in other elements in the array the output returns False. what is wrong with my code?
def linear_search(A, n, v):
answer = False
n = len(A)
for i in range(n):
if A[i] == v:
answer = i
else:
return None