I'm unsure of what they want me to do here, great to get help!


#1

Hi I am stuck on the practice makes perfect question. Below is my answer but it is wrong, I know it is with the cube(number) part, but I am not sure what to do.

def cube(number):
return (number^3)

def by_three(number):
if number/3 == cube(number):
return number/3
else:
return False

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).
Define a second function called by_three that takes an argument called number.
if that number is divisible by 3, by_three should call cube(number) and return its result. Otherwise, by_three should return False.
Don't forget that if and else statements need a : at the end of that line!


#2

I figured it out!
def cube(number):
return (number**3)

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