# Python Student Becomes Teacher 5/9

#1

Please what's wrong with this 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)/len(numbers)

#2

Make sure that the function `average` is indented properly. It looks like it might not be correctly indented.

#3

def average(numbers):
total = sum(numbers)
total = float(total)
average = total / len(numbers)
return average

You need to return the average, not the total.
set the float(total) / len(numbers) equal to the average.

#4

How does the code know what the variable "numbers" is? is it because you can't add strings together?

#5

Hello

# objectjumper57813

u may getting the syntax error it's
SyntaxError: 'return' outside function

to correct it by writing return function inside the average function . Look below the code

def average(numbers):
total = sum(numbers)
n = len(numbers)
total = float(total)/n

#6

It's not that, you can return total but you have to do it in the right place: inside the function

#7

You should `return total` in the right place: inside the function.
Like this:

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