Just Weight and See


#1



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

I tried to do the best code possible for what the exercise ask for but even the screen returns non i get:
Oops, try again. get_average(alice) raised the following error: unsupported operand type(s) for *: 'function' and 'float'

i would like to see if anyone can help to get the info i need. I know i can copy and paste an answer from the forum but i would like for someone to help in getting the most efficient code

lloyd = {
    "name": "Lloyd",
    "homework": [90.0, 97.0, 75.0, 92.0],
    "quizzes": [88.0, 40.0, 94.0],
    "tests": [75.0, 90.0]
}
alice = {
    "name": "Alice",
    "homework": [100.0, 92.0, 98.0, 100.0],
    "quizzes": [82.0, 83.0, 91.0],
    "tests": [89.0, 97.0]
}
tyler = {
    "name": "Tyler",
    "homework": [0.0, 87.0, 75.0, 22.0],
    "quizzes": [0.0, 75.0, 78.0],
    "tests": [100.0, 100.0]
}

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


#2

In your function here you are returning the function itself. You need to return the total that you just calculated.


#3

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