summaryrefslogtreecommitdiff
path: root/synth/avg_stddev.py
blob: 421a1aa08364e0a22be588e7ee6ba11574d6c076 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/python

import sys
import math

vals=[]
sum=0
cnt=0

for line in sys.stdin:
	num=float(line)
	vals.append(num)
	sum=sum+num
	cnt=cnt+1

avg=sum/cnt

stddev=0
for val in vals:
	stddev=stddev+ (val-avg)**2

stddev=stddev/cnt
stddev=math.sqrt(stddev)


print "avg is    " , avg
print "stddev is " , stddev