Code Challenges
- FizzBuzz
- Mean of a List
- Median of a List
- Variance of a List
- Standard Deviation of a List
- Sample Covariance
- Correlation Coefficient
- Simple Linear Regression
- Vector Dot Product
- Random Matrix
- Save
- Run All Cells
- Clear All Output
- Runtime
- Download
- Difficulty Rating
Loading Runtime
Create a function called var_list
.
This function will be passed a list of numbers and should return the sample variance of the numbers in the list.
As a reminder, the equation for sample variance is as follows:
Where:
s^2
is the variancen
is the sample sizex_bar
is the mean of the sample(x_i - x_bar)^2
is the squared deviation of a given point from the sample mean
So to calculate the variance, find the sum of the squared deviations of each data point from the mean and then divide by the sample size minus one: n-1
.
The final number that is returned by your function must be accurate to two decimal places, but does not need to be rounded to two decimal places.
Example:
var_list([3,4,6,6,77,4,3,2])
Returns: 668.125
Reset Code