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

16 lines
320 B
Python

import math
from _helpers import listInput
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)))
nums = listInput('Please input a list of numbers')
res = sd(nums)
print()
print('The list:', nums)
print('Standard Deviation:', res)