Hep with Practice makes Perfect


I'm having some trouble with this:

def cube(number):
return cube == 1 / 1 / 1

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

I don't know why it does not work and whenever I press "Save & Submit" it comes up with an error saying:

Oops, try again. cube(1) returned False instead of 1


The error tells you that your function will not give desired test output. Hence, you should re-write.

You will want to:

return number**3 #returns cube of number

Also, here:

you will want to do:

if number % 3 == 0:

which is a condition that if the number is divisible by 3 with no remainder.

PS: Ensure indentation is right.

Hope this helps! :slight_smile:


its now giving an error code that says:

Oops, try again. cube(1) resulted in an error: unsupported operand type(s) for ** or pow(): 'function' and 'int'


Nevermind, it works now


Okay, good to hear that.

Sorry for the late reply, though.

Have fun coding. :slight_smile:


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