the-honk/python/calculators/stdev.py
2024-10-09 18:02:29 +01:00

10 lines
No EOL
183 B
Python

import math
def sd(x):
n = len(x)
mean = sum(x) / n
squared = [y ** 2 for y in x]
return math.sqrt(abs((sum(squared) / n) - (mean**2)))
print(sd([135,230,132,323]))