"What's the average test score" and "how spread out were the scores" are two different questions about the same list of numbers, and they're both estimates: you're using the students who actually took the test to guess something about "students in general," a quantity you can never observe directly. The average of your actual data is your best guess at the expectation; how far the data typically strays from that average is your best guess at the variance.
The subtlety worth catching early: there are two slightly different ways to compute "typical spread" from a sample, and using the wrong one for the wrong purpose silently biases every downstream calculation that depends on it, standard errors, confidence intervals, t-tests, all built later in this curriculum.
Theory gives the mean as a direct average, and variance as average squared deviation from that mean, with one adjustable parameter (ddof) controlling which of the two standard divisors gets used.
Implement sample_mean(x) and sample_variance(x, ddof=0) against that reasoning. The signatures and docstrings are already in the editor.
x is a 1D array of numeric samples.sample_variance must respect ddof: ddof=0 divides by n, ddof=1 divides by n-1.float.Open one at a time. Each gives away a little more than the last.
np.mean and np.var already exist and already accept a ddof argument, you are wrapping them, not deriving the formulas from a loop.
Don't hardcode ddof=0 inside your implementation, pass the parameter straight through to np.var.
Click "Run Tests" to test your implementation