Return not in function. Why?


#1

def get_class_average(students):
    results()
for student in student:
    class_average=get_average(students)
    results.append(class_average) 
return average(results)

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

Anyone know what I'm doing wrong?


#2

As we can see, it is not in the function since it does not match the indentation of the function block.

This statement is not in the function, either.


#3

Ok, I see now. Having another problem now, will give it another crack. Thanks.


#4

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