document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. def aad(lst):
  2.     """
  3.        return the average absolute deviation of the list
  4.    """
  5.     temp = []
  6.     mean = sum(lst) / float(len(lst))
  7.     for i in range(len(lst)):
  8.         temp.append(float(abs(lst[i] - mean)))
  9.     return sum(temp) / len(lst)
  10.    
  11. def variance(lst):
  12.     """
  13.        return the variance of list
  14.    """
  15.     temp = []
  16.     mean = sum(lst) / float(len(lst))
  17.     for i in range(len(lst)):
  18.         temp.append(float(abs(lst[i] - mean))**2)
  19.     return sum(temp) / (len(lst)-1)
  20.    
  21. def stddev(lst):
  22.     """
  23.        return the standard deviation of the list
  24.    """
  25.     return variance(lst)**0.5
  26.  
  27. b = [6, 15, 26, 15, 18, 23, 19, 32, 28, 44]
  28.  
  29. print "Average Absolute Deviation : " + str(aad(b))
  30. print "variance : " + str(variance(b))
  31. print "SV : " + str(stddev(b))
');