index_min
index_min
Write a function index_min
which takes two arguments. The first argument is a list, say alist
. The second argument is a valid index value, i
.
The function should return the index of the minimum value in the sublist of alist
starting from index i
.
Example
[1, 2, 3], 0
=> 0
[1, 2, 3], 1
=> 1
[1, 10, 1000, 100], 2
=> 3
Challenge 0
If i
is not provided, default it to an appropriate value and the function should still work properly.
Challenge 1
Refactor the code to only one line.
Last updated