Write a programExercise 3/4Elementary20 XP

Where the smallest item is

Task

Write a function index_minima(zoznam) that returns the index of the smallest item of a non-empty list. If the smallest item occurs more than once, return the index of its first occurrence.

Do not use the min or sorted functions or the index method.

Examples

  • Call

    print(index_minima([5, 3, 8, 3, 9]))

    Expected output

    1

Rules

  • Find the minimum with a loop - no min, sorted or index.

After you submit, 6 hidden tests will also check your solution: one item, the minimum at the start, the minimum at the end, a negative minimum twice, decimal numbers, equal ones, then a smaller one.

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.