livepython.net

136. Python Program to Find the Largest of Three Numbers Using a Function

Mediumreturn

Overview

Several return lines in one function: the first one reached gives the answer.

Problem Statement

Write a function largest(a, b, c) that returns the largest of its three numbers. Don't use max(): use if and return.

Then read three whole numbers, one per line, and print the answer, like this:

Largest: 9

Two or three of the numbers may be the same. Then any of the equal ones is the answer.

Use input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.

Input

One value per line: three whole numbers. Example:

4
9
2

Output

The output for that example:

Largest: 9

The tests try 5 different inputs, including negative and equal numbers.

Learn this firstChapter 15 · Python return Statement: Get a Value Back
solution.py
# write your code here

EXPECTED OUTPUT

1Largest: 9

YOUR OUTPUT

Press Run to see your output here. Lines are compared with the expected output.