Challenge: Biggest of Three

Lab Python Beginner 10 points

Write a function biggest(a, b, c) that returns the largest of three numbers without using the built-in max(). Use if statements instead.

Input

Three whole numbers on one line.

Output

The biggest number.

Example

Input

3 9 4

Output

9
Sample input available Sample output available
Editor
Python

Hints

Start by assuming a is the biggest.

Compare b and c against your current biggest one at a time.

Solution explanation

Keep track of the largest value so far and replace it whenever a bigger one comes along. This “best so far” idea works for lists of any length too.

Show solution
def biggest(a, b, c):
    largest = a
    if b > largest:
        largest = b
    if c > largest:
        largest = c
    return largest


a, b, c = [int(x) for x in input().split()]
print(biggest(a, b, c))
Output
Answer
HOME LEARN COMMUNITY DASHBOARD