Save & Submit Code Reset Code Back to Editor 6. Just Weight and See


#1

Can I get some help with this problem please?

def get_average (student):
homework = average(student['homework']) * 0.1

quizzes = average(student['quizzes']) * 0.3
tests = average(student['tests']) * 0.6
average = homework + quizzes + tests
return average

#2

Please start by posting a link to the exercise in question, as well as any error message.Thank you.


#3

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


#4

File "python", line 28
0.3 * average(student["quizzes"]) + average(student["tests"]
^
SyntaxError: invalid syntax


#5

Will need you to re-post your modified code, please. Thank you.


#6

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

https://www.codecademy.com/courses/python-beginner-en-qzsCL/1/2


#7

It looks like Python does not accept the continuation operator in this statement. Try to just return the sum of the three variables.

    return homework + quizzes + tests

This will be the weighted average for the student.


#8

It worked. I'm not sure why the example did not work.Thanks


#9

Correction. There is not problem with the operator in this application. I hadn't tested it before but now have. Pardon me.