# 8 Standard Deviation

#1

Hello, my first post here, I've checked previous discussions but got none the wiser. Why didn't my code work?

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

total = 0

# use float() to make sure the average will return decimal places
return average

variance = 0
sqdf = (average - i ) ** 2
variance = variance + sqdf
return result

result = variance ** 0.5
return result

#2

@demiaca

#3

Sorry, just added contents to my original blank post. First time poster, didn't realise it went off after hitting 'enter'.

#4

Can you tell us what error message you get with the link to the exercise please?

#5

In the console I got this:

Traceback (most recent call last):
File "python", line 32, in
File "python", line 23, in grades_variance
TypeError: unsupported operand type(s) for -: 'function' and 'int'

At the bottom of the screen, the error message is this:

Oops, try again. Your code appears to raise an error, see the console window for the error message!

#6

Hi this part

``````def grades_variance(grades):
variance = 0
sqdf = (average - i ) ** 2
variance = variance + sqdf
return result``````

here

``average = grades_average``

you should put average equal to the call function of grades_average() with the argument grades like that

``average = grades_average(grades)``

#7

It works! Thank you!!!

#8

It works for me.

``````def grades_std_deviation(variance):
sqr_root = variance ** 0.5
return sqr_root