#1

I'm supposed to create a function but i dont understand what's wrong???

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

#2

For your cube function, you're not looking for the remainder. You're supposed to cube the number.
Make number to the power of 3.

#3

``````> def cube(number):
>     return number % 3
> def by_three(number):
>     if number % 3 == 0: # <--- Fix this
>         return cube(number)
>     else:
>         return False``````

#4

But this wouldnt fix the problem.
With your fix the function "by_three" would return 0 or False always.

#5

Well what is the error message?

#6

The condition returns zero because the "cube" function is misinterpreted. The function should raise the cube and return that result if that number entered as an argument satisfies the true condition within the "by_three" function. You only replace the % operator with ** on line 2.

``````def cube(number):
return number ** 3 # <--- Fix this to
def by_three(number):
if number % 3 == 0:
return cube(number)
else:
return False``````

I hope to be helpful.

#7

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