Practice Makes Perfect


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

it says Oops, try again.
Did you define a function called by_three?

someone please help

Replace this line with your code.



How did you indent the code? We can not link directly to your exercise.


Add the following below your def cube(number) -
return result

Let me know if that works.

That is how I interpreted the - instructions
First, def a function called cube that takes an argument called number. Don't forget the parentheses and the colon!
Make that function return the cube of that number (i.e. that number multiplied by itself and multiplied by itself once again).


screenshot of my code


Make sure that your indentations look like this -

Def and Def in line.


the by_three function shouldn't be nested inside the cube function, the by_three function should be after the cube function, you can achieve this by changing the indention.


Also if you feel that your topic was solved, do not forget to mark it as such.



thanks guys much appreciated it worked :slight_smile:


We help each other. Coding can be overwhelming, I have found that the people on the code academy forum are very helpful & I have not seen any nastiness (which is very rare for online discussions).
That is the reason I am staying with code academy. As soon as I am finished with the python course, I am going to upgrade to pro.

Good luck with the coding further.