Just weight and see help pls :3


#1

hi this is my code and when I press save & submit code it is just comes up with the error message saying: get_average(alice) raised the following error: can't multiply sequence by non-int of type 'float'. I know im not very good at coding and probably just made some kinda dumb mistake :blush: but pls someone help me try to understand this! <3

def average(numbers):
    total = sum(numbers)
    total = float(total)
    total = total / len(numbers)
    return total
    
def get_average(student):
    homework = average(student["homework"])
    quizzes = average(student["quizzes"])
    tests = average(student["tests"])
    weighted = ("homework"*0.1)+("quizzes"*0.3)+("tests"*0.6)
    return weighted

#2

this line:

weighted = ("homework"*0.1)+("quizzes"*0.3)+("tests"*0.6)

homework, quizzes and tests should be variable, you defined them on the lines above

why do you use parentheses here? there is something called order of operations, multiplying will happen before adding/sum


#3

thank you! this helped a lot!!! :blush:


#4

did you resolve the issue?


#5

yup :grinning: thx so much!


#6