Read the question, write Python on the right, then Run or Check.
QuestionHint and solution stay closed until you open them
Read three integers (one per line) and print the largest.
Python has max() built in — but try it once with plain if statements too, so you understand what max() does under the hood.
Input. Three lines, each one integer.
Output. One integer: the largest of the three.
Examples
Input
3 9 4
Output
9
Input
5 5 2
Output
5
Hint
- max(a, b, c) returns the biggest of the three.
- By hand: start by assuming a is biggest, then compare against b and c.
Show correct code
Peek only after you have tried. You can still Check your own version.
a = int(input())
b = int(input())
c = int(input())
print(max(a, b, c))
main.pyPython · Ctrl + Enter runs
ResultIdle
Run to see output. Check grades the tests.