You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
252 B
Python
18 lines
252 B
Python
2 years ago
|
from math import *
|
||
|
|
||
|
s = [float(x) for x in '176 176 176 176 175'.split('\t')]
|
||
|
|
||
|
|
||
|
def avg(list_):
|
||
|
m = 0
|
||
|
ms = 0
|
||
|
for v in list_:
|
||
|
m += v
|
||
|
ms += v ** 2
|
||
|
n = len(list_)
|
||
|
|
||
|
m /= n
|
||
|
ms /= n
|
||
|
return (m, ((ms - m ** 2) / (n * (n - 1))) ** 0.5)
|
||
|
|
||
|
print(avg(s))
|