import numpy as np
data = np.array([1, 3, 5, 7, 9])
sd = np.std(data)
var = np.var(data)
print(f"Standard deviation: {sd:.2f}")
print(f"Variance: {var:.2f}")
#For free code visit clcoding.com
import statistics
data = [1, 3, 5, 7, 9]
sd = statistics.stdev(data)
psd = statistics.pstdev(data)
print(f"Standard deviation: {sd:.2f}")
print(f"Population standard deviation: {psd:.2f}")
#For free code visit clcoding.com
0 Comments:
Post a Comment