Hard
A Density Histogram
Read numbers and a number of bins k. Draw
ax.hist(data, bins=k, density=True). Print each bar's height × width rounded to 3 decimals on one line (these are the share of data in each bin), then the total of those areas rounded to 3 decimals, which should be 1.Input
Numbers, then k.
Output
Two lines.
Sample 1
Input
1 2 2 3 3 3 4 4 5 4
Output
0.111 0.222 0.333 0.333 1.000
Sample 2
Input
1 2 3 4 2
Output
0.500 0.500 1.000
Output appears here