In this case the prints do work


grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]

def print_grades(grades):
    for grade in grades:

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

def grades_std_deviation(variance):
    return (variance**.05)

variance = grades_variance(grades)

error output is:

Oops, try again. grades_std_deviation(9.0) returned 1.116123174 instead of the expected: 3.0

now, to be fair, I just got this error and have not put the brain to work on it yet.

I assume right off the bat that the problem lies in this:

def grades_std_deviation(variance):
    return (variance**.05)

normally I would add a print statement or two.

def grades_std_deviation(variance):
    return (variance**.05)

to see if that return statement will function as I have it set. in this case the prints do work. I immediately noticed the difference in values and looked closer and saw the typo in the return string.

15. Remove Dupes : Shot down twice by the interpreter

Indentation error; scope issue.


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