Variance


#1

Here is my code:

http://prntscr.com/cefist

This is my error for this:

Oops, try again. You did not print the correct variance. Double-check your code and make sure you print the variance!

I think this should be correct.

def grades_variance(scores):
    n_av = grades_average(scores)
    variance = 0
    for score in scores:
        variance +=  ((n_av - score) ** 2)
        total_var = variance / float(len(scores))
    return total_var
    print grades_variance(scores)


#2

the function call:

print grades_variance(scores)

should be outside the function (Change the indent) and the argument should be grades (the list which holds your grades)


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.