9. It says my code isn't printing the sum of grades on its own line, but it is


#1

What am I missing here?
Error text:

Oops, try again. It looks like the sum of grades was not printed! Make sure you are
printing it on its own line.

Here's my 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

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

def print_grade_info(grades):
    for grade in grades:
        print grade

    variance = grades_variance(grades)
    print "Sum: "+str(grades_sum(grades))
    print "Average grade: "+str(grades_average(grades))
    print "Variance: "+str(grades_variance(grades))
    print "STDDev: "+str(grades_std_deviation(variance))

print_grade_info(grades)

Output:

100
100
90
40
80
100
85
70
90
65
90
85
50.5
Sum: 1045.5
Average grade: 80.4230769231
Variance: 334.071005917
STDDev: 18.2776094147

#2

@courseslayer18988

You forgot an indentation

def print_grade_info(grades):
    for grade in grades:
        print grade