← Back to Data Structures & Algorithms
Question 543
Running Minimum
Running Minimum
Write smallest(values: list[int]) -> int that returns the smallest value using one pass and a running lowest variable, without calling min() or sorted(). The list always has at least one value, so lowest starts as the first element and the loop runs over the slice values[1:]. Do NOT write a main block or any top-level test code; the tests construct the calls. Input: one line of space-separated integers; the tests print the value your function returns.
Expected Output:
1= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Data Structures & Algorithms
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.