Review problem too!


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

def grades_std_deviation(grades):
    variance = grades_variance(grades)
    result = variance ** 0.5
    return result

print print_grades(grades)
print grades_sum(grades)
print grades_average(grades)
print grades_variance(grades)
print grades_std_deviation(grades)

it returns"grades_std_deviation(840.2222222222221) raised an error: 'float' object is not iterable"
and i think on the right screen it prints everything correctly?
cannot figure out what was wrong
kindly help, thank you in advance:)


Hi @amberson,

Your grades_std_deviation function does not comply with Codedcademy's specifications, therefore it does not pass the submission correctness test (SCT), when Codecademy tests it, based on the expected specifications.

Note these instructions from 8. Standard Deviation ...

Define a function grades_std_deviation(variance).

return the result of variance ** 0.5

After modifying that function appropriately, you'll need to change this line ...

print grades_std_deviation(grades)

... to this ...

print grades_std_deviation(grades_variance(grades))

... or follow the third and fourth instructions, whereby you assign and use a global variable, variance. Either way, it should work.


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