Just Weight and See


#1



can someone help me? I'm stuck at "Student becomes the teacher - Just Weight and See"


my error is
"Oops, try again. get_average(alice) raised the following error: global name 'avarage' is not defined"


I expected it to run correctly however it seems to throw that error when ever I compile it


this is my 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]
}

students = [lloyd, alice, tyler]

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


#2

Check your spelling.


#3

thankyou i totally spaced it


#4

Hello, check the spelling of "student and average". Happy coding!

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))
   result = total / float(len(numbers))
   return result

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

#5

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