When I run my code as part of the lesson I get
**Oops, try again.
grades_variance([9, 5]) returned 0.6153846154 instead of the expected: 4.0
When I run it in Codecademy Labs (Python) I get the answer that the lesson says it was expecting (so in the above example if I run it with [9,5] I get the correct answer of 4.0 , not what the lesson says it got running it for me (0.6153846154).
I don't get why I seem to be getting two different results with exactly the same code, both running in different places in Codeecademy.
Can anyone see where I'm going wrong (and thanks for taking to time to help or to try to help) ?
grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5] def grades_sum(grades): total = 0 for grade in grades: total += grade print "total: " + str(total) return total def grades_average(grades): sum_of_grades = grades_sum(grades) average = sum_of_grades / float(len(grades)) print "average: " + str(average) return average def grades_variance(scores): average = grades_average(scores) variance = 0 for score in scores: print (average - score) ** 2 variance += ((average - score) ** 2) print variance answer = variance / float(len(grades)) print answer return answer print grades_variance(grades)