Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


What does the error 'number not defined' mean, when writing Python function code ?

I am writing a function to find the square of a number in one of the exercises. I get the Error message:

'number not defined' ?

1 Answer

Steven Parker
Steven Parker
229,967 Points

I'd need to see the actual code to be sure, but I'd guess that you have used the word "number" as an identifier in your code, but the code tries to perform some operation on it before the variable has been created.

To make it easier to get specific answers to future questions, always show your code and provide a link to the course page you are working with.