Python Program to calculate mean & standard deviation of user input numbers.


Hint: to calculate the square root for a number, import math library and use function sqrt (math.sqrt(number))
Sample output:

import math

def a(n1,n2,n3,n4,n5):
n = (n1+n2+n3+n4+n5)/5
return n

def stdev(n1,n2,n3,n4,n5,n):
s = math.sqrt((((n1-n)**2) + ((n2-n)**2) + ((n3-n)**2) + ((n4-n)**2) + ((n5 – n)**2))/5)
return s

n1 = float(input(“Enter the first number”))
n2 = float(input(“Enter the second number”))
n3 = float(input(“Enter the third number”))
n4 = float(input(“Enter the forth number”))
n5 = float(input(“Enter the fifth number”))

n = a(n1,n2,n3,n4,n5)
s = stdev(n1,n2,n3,n4,n5,n)
print(“Standard deviation=”, s)