Standard library · 10 / 17 Exercise Medium

Statistics summary

Objective

Create a Python program that calculates the mean, the median and the standard deviation of a series of numbers with the statistics module.

Instructions

  • Import the statistics module.
  • Read an integer n and then n integers, one per line.
  • Calculate the mean (statistics.mean), the median (statistics.median) and the population standard deviation (statistics.pstdev).
  • Show three lines: Mean: M, Median: D and Deviation: S, all with two decimals.
Input
5
2
4
4
4
5
Output
Mean: 3.80
Median: 4.00
Deviation: 0.98

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise