mean median mode python code example
Example 1: how to get median mode average of a python list
>>> import statistics
>>> statistics.median([3, 5, 1, 4, 2])
3
>>> statistics.median([3, 5, 1, 4, 2, 6])
3.5
Example 2: calculate mean on python
def calculate_mean(n):
s = sum(n)
N = len(n)
mean = s / N
return mean