CJCoding With Joseph
15free / daySign inCreate account

Every Index Of A Target

Write all_indexes(values: list[int], target: int) -> list[int] that returns a list of every index whose value equals target, in increasing order, or an empty list when it never appears. Loop over range(len(values)) and append() each matching index to a found list. Do NOT write a main block or any top-level test code; the tests construct the calls. Input: two lines, a space-separated list of integers and then the target; the tests print the list your function returns.

Expected Output:

[0, 2, 4]

= newline. The output ends with a newline — print one after the last line.

Hints3 available
Topics:
Data Structures & Algorithms
📥 Auto-Input:
1 2 1 3 1\n1\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.