6. Just Weight and See


#1



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

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)


#2

@boardrunner11792,
With

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))

#3

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