Practise Makes Perfect


I keep getting the same error almost all the time unless I make changes to the indentation, which completely breaks the function.

def cube(number):
    return number**3
    if number % 3 == 0:
        return cube(number)
        return False

I get the error
"Oops, try again. by_three(1) resulted in an error: global name 'n' is not defined"
But I don't see by_three(1) or n in this code...


They actually asked you to make two functions. Since a function ends when the return keyword is reached, your function ends right on line 2 :slight_smile:.
So, you should reread the instructions and create a second function like they asked.
Do you know what you should do now? :wink:


Hi @blogsurfer36193,

Refresh the page to remove by_three from Codecademy's memory cache. Then, you'll still need to do some work on the code that you have on the page. See @intermediategamer's reply, for example.


Yeah, I'm an idiot. Thanks guys. XD


Hi @blogsurfer36193,

Have you gotten it to work yet? If not, post the most recent version of your code.


Yes, I have. Thank you.