Deviation from the Mean · Variance
Lesson 10
The standard deviation is the square root of the variance: \[\sigma[\alpha]=\sqrt{\operatorname{Var}[\alpha]}\ .\] Unlike variance, it has the same units of measurement as the random variable \(\alpha\).
Of course, Python has built-in methods for computing variance. The code below finds the expected value, variance, and standard deviation of a die roll.
from numpy import mean, std, var
space = list(range(1, 7))
print(mean(space))
print(var(space))
print(std(space))3.5
2.9166666666666665
1.707825127659933