livepython.net

97. Python Program to Find the Largest Number Until done Is Typed

MediumInput loops

Overview

A stop word that isn't a number: check for it first, and only then turn the answer into a number.

Problem Statement

Read whole numbers, one per line, until the user types done. Then print how many numbers there were and the largest one. For example, for 4, 17, 9 and done:

Count: 3
Largest: 17

If the first line is already done, print only:

No numbers

Numbers can be negative, so the largest may be below 0.

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; the last line is always done. Example:

4
17
9
done

Output

The output for that example:

Count: 3
Largest: 17

The tests try 4 different inputs.

Learn this firstChapter 11 · Python Input Loops: Keep Asking Until It's Right
solution.py
# write your code here

EXPECTED OUTPUT

1Count: 3
2Largest: 17

YOUR OUTPUT

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