Errors Claimed but,

Screen Link:
https://app.dataquest.io/m/308/measures-of-variability/11/sample-variance-unbiased-estimator

My Code:

Replace this line with your code


samples = [[0,3], [0,6],
           [3,0], [3,6],
           [6,0], [6,3]
          ]

import numpy as np
def standard_deviation(array):
    reference_point = sum(array) / len(array)
    
    distances = []
    for value in array:
        squared_distance = (value - reference_point)**2
        distances.append(squared_distance)
    
    variance = sum(distances) / (len(distances) - 1)
    
    return sqrt(variance)

groupstd = []
groupvar = []
for list in samples:
    stdd = standard_deviation(list)
    stdvar = standard_deviation(list) ** 2
    groupstd.append(stdd)
    groupvar.append(stdvar)

smpl_std = (sum(groupstd))/6
smpl_var = (sum(groupvar))/6

pop_var = np.var(population)
pop_std = np.std(population)

equal_stdev = pop_std == smpl_std
equal_var = pop_var == smpl_var

What I expected to happen:
I got no results in output. The exercises in Statistics section are becoming more frustrating. Sometimes I've had to log out of Dataquest and log back in to get an exercise output response. In the case of this example, it stated that my variables were undefined, yet you see in the attached picture and the code above that they were.

What actually happened: 

Replace this line with the output/error
Error


<!--Enter other details below: -->

@sbgraham72 I’m sorry you’re having such a hard time with the statistic course. I haven’t done this course yet but I just tried copy/pasting your code and didn’t have any problems. Perhaps a lost connection to the server? Some weirdness with the virtual machine? A glitch in the matrix? Tough to say…

I would say you should submit a ticket to have the DQ team look at this course if it keeps happening to you. Nothing worse than troubleshooting code that has nothing wrong with it!

EDIT_1:
Have you tried using the “Restore Initial Code” option at the bottom rather than logging out/in again?

Yes, thanks Mike, I did all that repeatedly.
I even copied and pasted their “answer” into the code zone and got the same response after restoring initial code.
Thanks for checking it out.
Regards,
Bruce

@sbgraham72

If you comment out your code and then copy and paste the solution into the code area and you still get an error, for sure there’s some kind of glitch and keeping at it will get you nowhere except frustrated. Resetting the code nor logging out will help.

When this happens to me and I skip to the next section and come back to it maybe a few hours or a day later to submit the answer.

I actually reported a ticket about this once, and then came back from my coffee to find that I could submit the answer and withdrew the ticket.

Thank for your feedback.
I eventually successfully ran the same code that initially didn’t work but did by coming back some time later.