All problems

How Volatile Are These Returns?

easyPythonNumPyStatistics

Halcyon Bank's trading desk calls a stock volatile when its daily returns swing widely around their own average. One volatility figure per stock goes on the dashboard, worked out from a window of days that the desk has already fixed. For this figure that window counts as the entire record — not as a sample drawn from a longer history — so what gets published is the population standard deviation.

Task: Print the population standard deviation of the returns in the window.

Input

The first line holds a single integer n, the number of days in the window. Each of the next n lines holds one day's return as a percentage. Returns may be negative and may carry decimals.

Output

One line holding the standard deviation with exactly two digits after the decimal point. A window in which every day returned the same figure prints as 0.00.

Example:

Input:
4
1
-1
2
-2

Output:
1.58

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…