Just weight and see


#1



https://www.codecademy.com/courses/python-beginner-en-qzsCL/1/2?curriculum_id=4f89dab3d788890003000096


File "python", line 31
return (homework * 0.1) + (quizzes * 0.3) + (tests * 0.6)
^
SyntaxError: invalid syntax

I don't understand why it's giving me a syntax error. I feel as though the code is correct.

def get_average(student):
    homework = average(student["homework"])
    quizzes = average(student["quizzes"])
    tests = average(student["tests"]
    return homework * 0.1 + quizzes * 0.3 + tests * 0.6


#2

The arrow points to where the interpreter stopped parsing. The error will be just before that.


#3

OH! I see the issue now. Thank you so much. I was unaware that it would place an error after the error. That almost seems silly. Thanks for the help!


#4

When we think about it, it makes perfect sense. The statement being parsed is unexpected, so parsing ceases at that point. However, the cause of the error, or exception is in the previous statement. That's what gave rise to the unexpected statement or expression.


#5

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