What am I doing wrong? pls helppp


Can somebody explain to me what am I doing incorrectly. Please helpp

Replace this line with your code.


cube() should be returning a value, not printing it.


return cube

is going to return a copy of the function, not a value.

return cube(number)

will pass a value to the function which will return its cube.


Thanks for quick reposnse; I corrected those mistakes and I'm still getting the same answer :confused:


Please post your raw code. We can barely read that picture and we cannot test it. Images should only be used if there is something visual you wish to convey. Plain text code is best in the forums. Be sure to include a link to the exercise, as well. Thanks.


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

And here's the link:

Thanks for your time and help.


I copy pasted the code and it erased the indententation which I did use.


Once formatted, your code looks fine. Did you try calling it with a couple of numbers?

print (by_three(9))

print (by_three(4))


Hi, @arcsurfer14300 ,

In the by_three function you have ...

return "False"

However, the instructions state ...

... Otherwise, by_three should return False.

Note that you are not being asked to return a string.


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