It's Okay to be Average


#1

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

return result

when i click on save&submit it got this. Can any one help me.

Oops, try again. Your code looks a bit off, see the console window for the error message!

File "python", line 26
SyntaxError: 'return' outside function


#2

Is this all of your code and can you please format it,


#3

Thank You!

Okay so this line is fine,

but this line doesn't need to be divide by 2 so just discard the, / 2

but the third needs to be stored in the same variable total and you should divide just the total by the length of your argument,

total = total / len(numbers)

and finally return the total,

return total


#4

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