Editor

Add Numbers Until Zero

Programs with input · Intermediate · about 8 min

A quiz has several rounds, and you type the points from each round. Read whole numbers, one per line, until a 0 is typed. The 0 only means stop: it is not one of the numbers. Points can be negative.

Then print how many numbers came before the 0, their total and the largest, each on its own line, as Count: 4, Total: 52 and Largest: 30. If the very first number is 0, print No numbers entered instead.

The prompts inside input() are not checked, only what you print.

Example

You type:

12
5
30
5
0

The program prints:

Count: 4
Total: 52
Largest: 30
number = int(input("Points (0 to stop): "))
# Keep reading until 0, then print the count, total and largest
The solution opens after your first Check.