How to Calculate the Standard Deviation of a List of Numbers in Python

import statistics

numbers = [1, 2, 3, 4, 5]
standard_deviation = statistics.stdev(numbers)
print(f"Numbers: {numbers}\nStandard Deviation: {standard_deviation:.2f}")

Output:

Numbers: [1, 2, 3, 4, 5]
Standard Deviation: 1.58

Leave a Comment

Your email address will not be published.