Introduction to Python

Mean before 0

Given a sequence of floating-point numbers, your task is to find out the mean of all the numbers that appear before the first 0 in the sequence.
The input of the program contains a sequence of floating-point numbers. Everything after 0 should be ignored. It’s guaranteed that the input contains at least one number before the first 0.
The program should print a single number - the average of the sequence before 0.
6.4 5.6 10 2 0 5


Time limit: 0.2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue