All problems

Averaging Around the Gaps

mediumPythonNumPynp.nanmean

Northgate Water publishes one number for the river at Milburn Weir each day: the average level across the day's hourly slots. Some slots hold the word nan instead of a level, which is the logger's marker for a reading that never arrived — nan is short for Not a Number. A slot like that is unknown, not low, so it must not be counted as a level of zero and must not be counted in how many readings the day had.

Task: Print the average of the readings that did arrive.

Input

The first line holds an integer n, the count of slots. Each of the next n lines holds either a level written as a number, or the exact text nan for a slot where no reading arrived. At least one slot holds a real level.

Output

One line holding the average, written with exactly two decimal places — so an average of 20 prints as 20.00, never 20.0 or 20.

Example:

Input:
4
10
nan
20
30

Output:
20.00

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…