← Back to Recursion
Question 593
Smallest By Recursion
Smallest By Recursion
Complete min_of(values: list[int]) -> int so it returns the smallest value in a non-empty list by recursion, without min(). The base case is written: a one-item list returns that item. Add the recursive case: call the function on the slice values[1:], store the result in a variable rest_min, then return values[0] if it is smaller than that result and rest_min otherwise. Do NOT write a main block or any top-level test code; the tests construct the calls. Input: one line of integers separated by spaces, at least one, which the tests read into a list and pass to your function before printing the value it returns.
Expected Output:
1= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
RecursionSlicing
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.