def grades_average(grades): sum_of_grades = grades_sum(grades) average = sum_of_grades / float(len(grades)) return average def grades_variance(scores): average = grades_average(scores) variance = 0 for score in scores: variance += ((average - score) ** 2) result = variance // float(len(scores)) return result
Gives me the following error:
Oops, try again. gradesvariance([2, 6, 8]) returned 6.0 instead of the expected: 6.2222222222
So my guess is that my variable "result" is being stored as an integer and losing part of it's identity in the process...
How do I fix this?