grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5] def print_grades(grades): for grade in grades: print(grade) return def grades_sum(grades): total = 0 for grade in grades: total += grade return total 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 = variance + ((average - score) **2) s = (variance/len(scores)) return s def grades_std_deviation(variance): return (variance**.05) variance = grades_variance(grades) print(grades_std_deviation(variance))
error output is:
Oops, try again. grades_std_deviation(9.0) returned 1.116123174 instead of the expected: 3.0
now, to be fair, I just got this error and have not put the brain to work on it yet.
I assume right off the bat that the problem lies in this:
def grades_std_deviation(variance): return (variance**.05)
normally I would add a print statement or two.
def grades_std_deviation(variance): print(variance) print(variance**.5) return (variance**.05)
to see if that return statement will function as I have it set. in this case the prints do work. I immediately noticed the difference in values and looked closer and saw the typo in the return string.