Print is invalid syntax? 7/9


print grades_variance(grades)

I have tried everything, and I am 100% sure that it is the print statement causing the error. What am I doing wrong?


Hi @uberlyuber ,

Don't be so sure that the print statement is where you made a mistake.

Take a look at this code ...

y = max(8, 4, 7
print y

Here's the error message that resulted from the above ...

  File "python", line 2
    print y
SyntaxError: invalid syntax

But where did I make my mistake?


def grades_variance(ok):
average = grades_average(ok)
variance = 0
for i in ok:
variance += (average - i) ** 2
result = variance / len(ok)
return result
print grades_variance(grades)