← Back to Functions
Question 352
Largest Without Max
Largest Without Max
Write def largest_of(values: list[int]) -> int that returns the biggest number in the list, which always has at least one element, without using the built-in max: take the first element as the biggest so far, then loop over the list and replace it whenever a bigger value turns up. Do NOT write a main block or any top-level test code; the tests construct the calls. Input: a count on the first line, then that many integers one per line; the tests read them, build the list, pass it to your function and print the value it returns.
Expected Output:
9= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
Functions
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.