# It's Okay to Be Average- What is wrong w/ my code?

#1

Oops, try again. Your code looks a bit off, see the console window for the error message:
File "python", line 21
def average(number):
^
IndentationError: unexpected indent

I saw a video where someone typed it the smae way i did, but they got it right.

``````Replace this line with your code.
def average(number):
total = sum(number)
aver = float(total)/len(number)
return aver``````

#2

@orlibird
The error

point to the fact that you did not start the def at position-zero of your editor....

Remove eventual space-characters.....

#3

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

try this... it should help

#4

This Worked for me thanks

#5

#6

That isnt working for me

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