Overlaying a KDE Curve on a Histogram
Calder Health charts patient blood-pressure readings as buckets with a smooth curve drawn over them, so a reader sees the overall shape without being distracted by which bucket a reading happened to fall in. A curve invites the eye to guess a centre and a width, so the two numbers it is guessing at are printed underneath rather than left to the reader.
Task: Print the average reading and how much the readings vary.
Input
The first line holds one integer n, the number of readings. Each of the next n lines holds one reading, a number on its own.
Output
One line holding two numbers separated by a single space: the average reading, then the sample standard deviation — the version that treats these readings as a sample standing in for a wider population rather than as the whole population itself. Each carries exactly two decimal places.
Example:
Input:
4
10
20
30
40
Output:
25.00 12.91
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