Review


#1

Can someone help me what is wrong with my code? I can't fint out what is wrong with it?

I get an error:
Oops, try again. grades_std_deviation(911.49) returned 18.2776094147 instead of the correct value 30.1908926665

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(scores):
    average = grades_average(scores)
    variance = 0
    num_scores = len(scores)
    for score in scores:
        variance = variance + (average - score) ** 2
    variance = variance / float(num_scores)
    return variance

def grades_std_deviation(variance):
    variance = grades_variance(grades)
    variance = variance ** float(0.5)
    return variance
    
print print_grades(grades)
print grades_sum(grades)
print grades_average(grades)
print grades_variance(grades)
print grades_std_deviation(grades)

#2

from 8. standard deviation, instructions 3:

After the function, create a new variable called variance and store the result of calling grades_variance(grades)

which you did:

variance = grades_variance(grades)

except you seem to have missed this part of the of the instructions: After the function


#3

Ooo...Thanks for your help!


#4