Stuck on Standard deviation!


#1

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

def print_grades(grades_input):
for grade in grades_input:
print grade

def grades_sum(scores):
total = 0
for score in scores:
total += score
return total

def grades_average(grades_input):
sum_of_grades = grades_sum(grades_input)
average = sum_of_grades / float(len(grades_input))
return average

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

def grades_std_deviation(variance):
return variance**0,5

variance=grades_variance(grades)
print grades_std_deviation(variance)

INSTRUCTIONS:
Define a function, grades_std_deviation, that takes one argument called variance.

return the result of variance ** 0.5

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

Finally print the result of calling grades_std_deviation(variance).

ERROR TYPE:
grades_std_deviation(20.25) returned (1.0, 5) instead of the expected: 4.5


#2

Your grades_std_deviation returns variance**0,5 instead of variance**0.5


#3

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