Why does this code return an error?



File "python", line 23
return variance
SyntaxError: invalid syntax

Why does it return an error when I try to return the variance?

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


look at the parentheses on the line above the error, they don't match


Thank you. Now it doesn't return the right value but let's see if I can work that out


It would be good if you could work that out yourself, if you need help, post an updated version of your code and i will help you


I solved it but thank you for your help :slight_smile:


always better if you solve it yourself :slight_smile:


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