What am I doing wrong? pls helppp


#1



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


Replace this line with your code.


#2

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

And,

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.


#3

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


#4

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.


#5

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

And here's the link:


Thanks for your time and help.


#6

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


#9

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

print (by_three(9))

print (by_three(4))

#10

Hi, @arcsurfer14300 ,

In the by_three function you have ...

return "False"

T
However, the instructions state ...

... Otherwise, by_three should return False.

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


#11

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