# Help finishing Python Lesson 9.9 Exam Statistics

#1

I have triple checked my code and have run it in repl.it and it works fine. but Codecademy keeps spinning and spinning as if in a loop when I run it. Is this a bug or am I completely off???

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

total = 0
for i in scores:
total += i

average = 0
return average

variance = 0
for score in scores:
variance = variance + (average - score) ** 2

variance = variance / len(scores)
return variance

variance = variance ** 0.5
return variance

``````

#2

`variance` is undefined.

``print grades_std_deviation(grades_variance(grades))``

#3

thanks for the help. I saw this detail on a previous thread from a month ago and tried it too. I still cant stop the infinite loop. It actually begins on lesson 9/7 for variance. When I run that it infinite loops, and for some reason let me click NEXT. on lesson 8 too. then on 9/9 I cant get to click NEXT. been working on this for weeks now

#4

#5

#6

I can get lesson 9/5 to run. the 9/6 is just a run the print line. 9/7 “Variance” is where the bugginess begins for me

#7

Just a note that pertains to this module/exercise, only… The data contains one float, so the return value from grades_sum will be a float. That value will carry all the way through so all return values will be floats. Given this convenient exception, remove the float() function from your code anywhere you may have written it.

Now, were we given all integer data, then we would need to explicitly return a float from grades_sum.

``````total = float(0)
``````

or

``````total = 0.0
``````

will suffice and carry all the way through the other functions.

These are my last six lines…

``````print_grades(grades)
print variance
``````

The output is as follows:

``````100
100
90
40
80
100
85
70
90
65
90
85
50.5
1045.5
80.4230769231
334.071005917
18.2776094147
``````

#8

WOW, you are amazing! that was it!!
I was thinking of that float in the beginning but never realized it could be such a BIG deal!

thanks a lot mtf

#9

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