Standard Deviation


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<In what way does your code behave incorrectly? Include ALL error messages.>

I get the following error message, any help would be appreciated.

Traceback (most recent call last):
File “python”, line 31, in
File “python”, line 29, in grades_std_deviation
TypeError: unsupported operand type(s) for ** or pow(): ‘list’ and ‘float’
<What do you expect to happen instead?>

```python

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)
avg = sum_of_grades / float(len(grades))
return avg

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

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

<do not remove the three backticks above>

#2

This line should not be indented. Remove the indent and the code will run and pass.


#3

Thank you so much! It worked