Practice makes perfect (Needs Debug)


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

It should return 27, but instead returns 3.


You need to call your cube function.


is this not it? This is what the lesson said to do.


You have called your by_three method in your last line, but you have not called your cube method anywhere.


However, In the previous lesson, it specifically told me how to do this:


I am not sure you understand what “calling a function” means.


Calling the cube function on the by three function returns 27, but the lesson won’t accept that.


I see what your problem is. Basically, you are not calling “cube”, as “overcantor” mentioned in your “by_three” function. The code should read something like:

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


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.