Find the First Matching Index
Scan a list once and return the index of the first value equal to the target.
The problem
Implement first_index(values, target). Return the smallest index i where values[i] == target, or -1 if target does not appear in values. Write the loop yourself: do not use list.index.
Starter code
def first_index(values, target):
passPublic examples
values = [4, 2, 4, 7], target = 4gives0values = [1, 3], target = 2gives-1
Solving it in the practice book needs an active paid plan.
Open it in the practice bookOne thought at a time.
