# Just weight and see HELP

#1

I do not know what is wrong with my code, I've checked it again and again with no luck. Just look at it and see.

The error it says is: Oops, try again. get_average(alice) raised the following error: unsupported operand type(s) for *: 'float' and 'NoneType

Here 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]
}

def average(numbers):
total = sum(numbers)
total = float(total)

def get_average(student):
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(student["tests"])
return 0.1 * homework + 0.3 * quizzes + 0.6 * tests

#2

ok so you have messed up somewhat on your total statements here. With total you want not only the sum times numbers but you also want float times sum times numbers. Therefore, your next total statement will be the total you just got from float times sum times numbers divided by the len times numbers. This will give you the average you are looking for.

#3

Here is an update, but I don't know why it is wrong:

def get_average(student):
total = 0
total = sum(numbers)
total = float(total)
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(student["tests"])
total = 0.1 * homework + 0.3 * quizzes + 0.6 * tests

and it says the error is: Oops, try again. get_average(alice) raised the following error: 'float' object is not iterable

#4

Not sure what your trying to do here but its not necessary. get rid of it and your code should work. Everything else looks good!

#5

I dont know man, you are trying to help, but the program is i dont know, just look:

``````def get_average(student):
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(student["tests"])
total = 0.1 * homework + 0.3 * quizzes + 0.6 * tests

and the error is:

Oops, try again. get_average(alice) raised the following error: unsupported operand type(s) for *: 'float' and 'NoneType

#6

Please show us your `average()` function. The above code looks operational so the error could be in the average function.

#7

Here is all of my code:

``````def average(numbers):
total = sum(numbers)
total = float(total)

students = [lloyd, alice, tyler]

def get_average(student):
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(student["tests"])
total = 0.1 * homework + 0.3 * quizzes + 0.6 * tests

#8

The average function has no return statement so is returning `None`.

#9

Ok that worked but now I have another error:

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

The code is here:

def average(numbers):
total = sum(numbers)
total = float(total)

students = [lloyd, alice, tyler]

def get_average(student):
homework = average(student["homework"])
quizzes = average(student["quizzes"])
tests = average(student["tests"])
total = 0.1 * homework + 0.3 * quizzes + 0.6 * tests

#10

Now we're making progress. Seems your average function is missing one last step:

``````def average(numbers):
total = sum(numbers)
total = float(total)