So, at the very end I am printing out all of the values for the list "grades" they ask for: all the grades, sum of the grades, average of the grades, variance of the grades, standard deviation of the grades. I was stuck on the sum and average of the grades both because codecademy wanted a very specifc number of decimal places to be printed for those values. I'm not sure if this is the same case for variance and standard deviation but for some reason it keeps giving the error: "Oops, try again. It looks like the variance was not printed! Make sure you are printing it on its own line".
Any help is appreciated. Thanks!
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 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(grades): average = grades_average(grades) variance = 0 for grade in grades: variance +=((average - grade) ** 2) return variance/(len(grades)) def grades_std_deviation(variance): return variance**0.5 variance = grades_variance(grades) print "Grades: " for grade in grades: print grade print "%.1f" % (grades_sum(grades)) print "%.10f" % (grades_average(grades)) print "%.10f" % (grades_variance(grades)) print "%.10f" % (grades_std_deviation(variance))