def aad(lst):
"""
return the average absolute deviation of the list
"""
temp = []
mean = sum(lst) / float(len(lst))
for i in range(len(lst)):
temp.append(float(abs(lst[i] - mean)))
return sum(temp) / len(lst)
def variance(lst):
"""
return the variance of list
"""
temp = []
mean = sum(lst) / float(len(lst))
for i in range(len(lst)):
temp.append(float(abs(lst[i] - mean))**2)
return sum(temp) / (len(lst)-1)
def stddev(lst):
"""
return the standard deviation of the list
"""
return variance(lst)**0.5
b = [6, 15, 26, 15, 18, 23, 19, 32, 28, 44]
print "Average Absolute Deviation : " + str(aad(b))
print "variance : " + str(variance(b))
print "SV : " + str(stddev(b))