Working on the review and I cannot get this to work. Everything in the last problem worked, but in this problem I can get everything to print but the Std Deviation. Would appreciate any help.
The error message:
"Traceback (most recent call last):
File "python", line 39, in
File "python", line 34, in grades_std_deviation
NameError: global name 'scores' is not defined"
When I change "scores" to "grades" I get:
"Oops, try again. grades_std_deviation(755.5) returned 334.0710059172 instead of the correct value 27.4863602538 "
Replace this line with your code. 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 print print_grades(grades) def grades_sum(grades): total = 0 for grade in grades: total += grade return total print grades_sum(grades) def grades_average(grades): sum_of_grades = grades_sum(grades) average = sum_of_grades / float(len(grades)) return average print grades_average(grades) def grades_variance(scores): average = grades_average(scores) variance = 0 for score in scores: variance += (average - score) ** 2 return variance / float(len(scores)) print grades_variance(grades) def grades_std_deviation(variance): variance = grades_variance(scores) variance ** 0.5 return variance print grades_std_deviation(grades)