Functions(how to make a nested functions)


#1

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.


#2

@designace09885,
First, def a function called cube that takes an argument called number. Don't forget the parentheses and the colon!
def cube(number):
Make that function return the cube of that number (i.e. that number multiplied by itself and multiplied by itself once again).
return number * number * number
Define a second function called by_three that takes an argument called number.
def by_three(number):
if that number is divisible by 3, by_three
if number %3 == 0:
should call cube(number) and return its result.
return cube(number)

Otherwise,
else:
by_three should return False.
return False