data2 = []
def variance
return
print variance(data2)
mean =
data = []
ndata = data – mu
ndata = []
ndata.append()
data3=[13.04, 1.32, 22.65, 17.44, 29.54, 23.22, 17.65, 10.12, 26.73, 16.43] def mean(data): return sum(data)/len(data) def variance(data): mu = mean(data) ndata = [] for i in range(len(data)): ndata.append((data[i] - mu)**2) sigma2 = mean(ndata) return sigma2
another simple pattern comes here
data3=[13.04, 1.32, 22.65, 17.44, 29.54, 23.22, 17.65, 10.12, 26.73, 16.43] def mean(data): return sum(data)/len(data) def variance(data): mu = mean(data) return mean([(x-mu)**2 for x in data]) print variance(data2)