Write variance(values) so it returns the average squared distance from the mean. Compute the mean first, then average the squared distances.
Write variance(values) so it returns the average squared distance from the mean. Compute the mean first, then average the squared distances.