import matplotlib.pyplot as plt
import numpy as np
from math import *
f2 = open('C:\\Users\\Audrey\\Documents\\samplestats data.txt')
lines = f2.readlines()
f2.close()
x1 = []
for line in lines:
p = line.split()
x1.append(float(p[0]))
#First we can find the mean
mean=(sum(x1)/len(x1))
print mean
#Next the sample variance (s^2). We use the mean which is 3.74
samplev=((sum(x1-3.74)**2)/(10-1))
print samplev
样本方差有问题,我该如何解决?