Functions-6


#1

Hello, I tried to do this task and it tells me I didn't define by_three as a function, so if anyone can help that would be much appreciated :smile:
def cube(number):
return number * number * number
def by_three(number):
if number % 3 == 0:
return cube(number)
else:
return False


#2

yeah it works

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

you can shorten your code to this

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

#3

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


#4

@websurfer41882 you code will not work. Check it very carefully