#!/usr/bin/env python import math import random def mean(): t, alist, mu = 0, [], 0 for i in range(1,501): alist.append(random.randint(1,501)) t=t+i mu = (t / len(alist)) #STD(mu,alist) def STD(): # this is the mean section t, alist, mu = 0, [], 0 for i in range(1,501): alist.append(random.randint(1,501)) t=t+i mu = (t / len(alist)) print "This computed Mean is: " + str(mu) # this is the STD portion ans, t, std = 0, 0, 0 for i in alist: t = t + math.pow(i - mu, 2) ans = (t / (len(alist)-1)) std = math.sqrt(ans) print "This computed Standard Deviation is: " + str(std) # this is test for skewness t, skew = 0, 0 for i in alist: t = t + math.pow(i - mu, 3) skew = ( t / ( ( len(alist) - 1) * math.pow(std,3)) ) print "This computed Coefficient of Skewness measure of symmetry is: " + str(skew) # this is test for Kurtosis t, kurt = 0, 0 for i in alist: t = t + math.pow(i - mu, 4) kurt = ( t / ( ( len(alist) - 1) * math.pow(std,4)) ) print "This computed Coefficient of Kurtosis measure of bight to STD: " + str(kurt) # this is Coefficient of Excessive Kurtosis compared with NOrmal print "Coefficient of Excessive Kurtosis compared with Normal: " + str(kurt - 3) def main(): mean() STD() # added proper main function if __name__ == "__main__": main()