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 second line has n integers. Print the smallest, then the largest, separated by a space.
Input. Line 1: n. Line 2: n integers.
Output. Two integers: min then max.
Constraints
- 1 ≤ n ≤ 1000
Examples
Input
5 3 1 8 2 4
Output
1 8
Input
1 42
Output
42 42
Hint
- min(nums) and max(nums) are built in.
- print(min(nums), max(nums)).
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(min(nums), max(nums))
main.pyPython · Ctrl + Enter runs
ResultIdle
Run to see output. Check grades the tests.