Read the question, write Python on the right, then Run or Check.
QuestionHint and solution stay closed until you open them
The first line is n, the count. The second line has n integers separated by spaces. Print the maximum.
The map(int, ...) pattern converts a whole line of text into numbers in one shot.
Input. Line 1: n. Line 2: n integers separated by spaces.
Output. One integer: the maximum.
Constraints
- 1 ≤ n ≤ 1000
Examples
Input
5 3 1 8 2 4
Output
8
Input
1 42
Output
42
Hint
- nums = list(map(int, input().split())) reads and converts every value.
- print(max(nums)) finishes the job.
Show correct code
Peek only after you have tried. You can still Check your own version.
n = int(input())
nums = list(map(int, input().split()))
print(max(nums))
main.pyPython · Ctrl + Enter runs
ResultIdle
Run to see output. Check grades the tests.