Just Weight and See -- error -- "can't multiply sequence by non-int of type 'float'"


My error message is "Oops, try again. get_average(alice) raised the following error: can't multiply sequence by non-int of type 'float'" After reading through so many other archived posts, I just can't see why this won't work. What is wrong with this code?

Thank you!

# Add your function below!
def average(numbers):
    total = sum(numbers)
    total = float(total) / len(numbers)
    return total
def get_average(student):
    grade_homework = average(student["homework"]),
    grade_quizzes = average(student["quizzes"]),
    grade_tests = average(student["tests"])
    return (grade_homework * 0.1) + (grade_quizzes * 0.3) + (grade_tests * 0.6)


Those commas may be doing more than we imagine. Try removing them and see if the program behaves any different.


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