Index Of Target
Index Of Target
Write index_of(values: list[int], target: int, position: int) -> int that returns the index of the first occurrence of target in values at or after the given position, or -1 when it is not there, by recursion that moves the position forward instead of slicing: when position equals len(values) the search has run off the end, so return -1; when the value at position equals target return position; otherwise recurse with position + 1. Do NOT write a main block or any top-level test code; the tests construct the calls with a starting position of 0. Input: two lines, the list as integers separated by spaces (it may be empty) and then the target, which the tests read and pass to your function before printing the value it returns.
Expected Output:
2= newline. The output ends with a newline — print one after the last line.
Your Output
Run your code to see the output here...