Just Weight and See


#1



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


Oops, try again. get_average(alice) returned 86.55 instead of the expected 91.15


I want the code to return 91.15 instead of 86.55. I've tried everything. I've been looking to other topics, but almost no one has had this problem. I really don't know how to solve this. Maybe I forgot to write something in the code?


Replace this line with your 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 = sum(numbers)
    total = float(total)
    total = total / len(numbers)
    return total
def get_average(student):
    homework = average(student["homework"]) * 0.1
    quizzes = average(student["quizzes"]) * 0.3
    tests = average(student["quizzes"]) * 0.6
    something = homework + quizzes + tests
    return something


#2

Here:

You should have tests and not quizzes again.

Hope this helps! :slight_smile:


#3

Geez! Thank you so much! I knew I missed something...

Man, really stupid of me for not seeing this simple solution.

Thank you again!


#4

You're welcome.

Glad I could help. Keep at it. :keyboard:


#5

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