Skip to content

Instantly share code, notes, and snippets.

@jrovegno
Created May 13, 2012 21:05
Show Gist options
  • Save jrovegno/2690196 to your computer and use it in GitHub Desktop.
Save jrovegno/2690196 to your computer and use it in GitHub Desktop.
standard deviation of the values
from math import sqrt
sum, sum2, n = 0.0, 0.0, 0.0
with open("numeros.txt") as infile:
for line in infile:
k = float(line)
sum += k
sum2 += k*k
n += 1
print sqrt(sum2/n - (sum/n)**2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment