Practice Makes Perfect


#1



https://www.codecademy.com/en/courses/python-beginner-c7VZg/1/5?curriculum_id=4f89dab3d788890003000096#


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

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


someone please help


Replace this line with your code.


#2

Hello

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


#3

Add the following below your def cube(number) -
result=number**3
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).


#4

screenshot of my code


#5

Make sure that your indentations look like this -

Def and Def in line.


#6

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.


#7

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

Thanks


#8

thanks guys much appreciated it worked :slight_smile:


#9

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.


#13