Danielle Murray
Danielle Murray
Python Development Techdegree Student 1,835 Points

I am having a problem understanding how to fix this error for my Basketball Team Stats Tool

Hi Guys

I do not understand how to fix this error and i've tried fixing it but it does not seem to work. Please could someone help me.

This is the error message: File "/home/treehouse/workspace/", line 48
return panthers, bandits, warriors, team_lists
SyntaxError: 'return' outside function

2 Answers

Chris Freeman
Chris Freeman
Treehouse Moderator 64,074 Points

When return is outside a function, usually the issue is the return statement needs to be indented further to the right.

This can also be caused by a preceding line also needed to be indebted to be inside a function. An insufficiently indented previous line will cause the parser to think the function code block has been “closed” thus making the subsequent return outside of the function.

Post back if you need more help. Good luck!!!

Mel Rumsey
.a{fill-rule:evenodd;}techdegree seal-36
Mel Rumsey
Treehouse Staff

Hi Danielle Murray! If you are still having issues feel free to reach out in Slack with any questions you might have. We can take a look at your code and help you with any TechDegree related questions. :)

Happy coding!