6. Just Weight and See



Oops, try again. get_average(alice) raised the following error: 'float' object is not iterable

I feel I'm messing up the last line. And I don't know why I'm getting float object not iterable message

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



return homework*0.1 + quizzes*0.3 + tests*0.6

you would already have the sum

If you really wnat to use sum() method

return sum((homework*0.1,quizzes*0.3,tests*0.6))


4 posts were split to a new topic: 6. just weight and see