1 · Learn and predict
Read this worked example. Predict its output, run it in Python 3, and explain how variables change.
def linear_search(values, target):
for position in range(len(values)):
if values[position] == target:
return position
return -1
print(linear_search([9, 3, 6, 1], 6))