Linear Search Creating and Calling Function
def lin_search(arr, x):
for i in range(len(arr)):
if arr[i] == x:
return i
return -1
# Test array
arr = [ 2, 3, 4, 10, 40 ]
x = 10
# Function call
result = lin_search(arr, x)
if result != -1:
print("Element is present at index", str(result))
else:
print("Element is not present in array")