Need help with "Just Weight and See"


#1



Doing "Just Weight and See"
https://www.codecademy.com/en/courses/python-beginner-en-qzsCL/1/2?curriculum_id=4f89dab3d788890003000096

Error message: Oops, try again. get_average(alice) returned 97.5 instead of the expected 91.15

Expected to Move on to the next course

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 = sum(numbers)
    total = float(total)
    total = total / len(numbers)
    return total
    
    
def get_average(student):
    homework = average(student['homework']) * 0.10
    quizzes = average(student['homework']) * 0.30
    tests = average(student['homework']) * 0.60
    return homework + quizzes + tests


#2

This post was flagged by the community and is temporarily hidden.


#3

@khanh.le if this is a solution you are presenting can you elaborate on why it work with regard to what the OP posted


#4

This post was flagged by the community and is temporarily hidden.


#5

def get_average(student):
homework=average(student["homework"])
quizzes=average(student["quizzes"])
tests=average(student["tests"])
return homework*0.1+quizzes*0.3+0.6*tests
its such a good practice of coding do not make your code dirty :stuck_out_tongue: