6 - Just Weight and See


#1

I dont get why this doesnt work. Please Help! want to learn....not just have someone give me an answer. Why exactly doesnt this work? says Oops, try again. get_average(alice) raised the following error: global name 'sudent' is not defined

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"])
quizzes = average(sudent["quizzes"])
tests = average(student["tests"])
return 0.1 * homework + 0.3 * quizzes + 0.6 * tests


#2

Hello!

You should read carefully the errors the console throws at you. It talks about some variable doesn't seem to exist (i.e. it's not defined). It says: global name 'sudent' is not defined. You probably meant student.


#3

Hi!

I am still not sure how to define student without using loops or strings. When i define student it still does not work, I can show that as well if it helps


#4

No, what the error meant is that inside your code there is a variable that doesn't exist. What the console doesn't know is that you just made a typo. Student is already defined. Read the error again.

I hope this helps.


#5

Holy crap there he is - lucifer! in the details....thank you!! I didnt realize that you were telling me i had a typo at first :disappointed: