Linear Search
Linear search checks values until it finds a match. It works on unsorted data and is often a sensible choice for a small input.
Understand the idea
Return the first matching position when that is the defined contract. A separate sentinel such as None can mean not found without colliding with index zero. Worst-case time is O(n) and extra working space is constant for this loop. A built-in membership test is clearer if you only need a yes/no result.
Where to try it
Open this example with Try in playground. The code loads as editable text and does not run until you select Run. The first run downloads Python. Each run starts fresh; temporary files created by a script are not files on your PC.
A worked example
def find_index(values, wanted):
for index, value in enumerate(values):
if value == wanted:
return index
return None
print(find_index([8, 3, 5], 3))
Read the result
The first match is at index 1.
Try one change
Test a match at position zero, a repeated match, and a missing value.