Can you help me write the syntax inside a python function, given the completed exercise I have somewhat mastered?

Can you help me write the syntax inside a python function, given the completed exercise I have somewhat mastered?
0.0 0

#1

Tell us what’s happening:
.
I believe that the by_three function is not reading correctly.

Here are the instruction related to the exercise:

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!

the link for the exercise is here: click here

Your code so far

def cube(number):
  return number * number * number

print cube(3)

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

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:


#2

This issue has been solved through my own error checking! :slight_smile: