about | help | code help+videos | done | prefs |
variance
Write a function variance(data) that returns the variance of a list of numbers named data. The variance is defined to be the mean of the squares of the numbers in the list minus the square of the mean of the numbers in the list. Round your answer to an integer, but be careful not to round until the last step of the computation. WARNING: If a and b are both integers then Codingbat will compute a/b as integer division unless you write it as a*1.0 / b. This is because it has Python 2.7 running in the background. variance([9, 1, 3, 2, 7, 5, 2, 8, 8]) → 8 variance([9, 1, 1, 8, 6, 9, 1, 7, 1]) → 12 variance([6, 6, 8, 9, 1, 2, 7, 7, 1]) → 8 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy