Write a programExercise 1/4Basic10 XP

All occurrences

Task

Write a function vyskyty(zoznam, hodnota) that returns a list of the indexes of every occurrence of the value in the list, from the smallest. If the value is not in the list, it returns an empty list.

For example vyskyty([1, 5, 2, 5, 5], 5) returns [1, 3, 4].

Examples

  • Call

    print(vyskyty([1, 5, 2, 5, 5], 5))

    Expected output

    [1, 3, 4]

After you submit, 4 hidden tests will also check your solution: the value is missing, an empty list, a list of texts, all items equal.

Python starts the first time you run code.

Ctrl+Enter runs the program. Tab indents. Press Esc, then Tab, to leave the editor.

Input (stdin)

Each line = one call to input().

Output

Hints

Try it yourself first. Each hint reveals a little more - and lowers the reward a little.

Signed out, hints are free - but no XP is awarded either.

Solution

The solution unlocks after the last hint.