It's Okay to be Average


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

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


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


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


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