def cube(number):
return "number*number*number"

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

    return False

it says cube(1) returned 'number*nmber*number' instead of 1


Hi, @almightytroll19,

You have this ...

return "number*number*number"

With the quotes, "number*number*number" is a string. Remove the quotes, so that it becomes a mathematical expression.


It will still be wrong even if you remove the quotes


@ryebread4 is correct in that there are additional problems. Removing the quotes, so that the return statement is as follows, will address the original problem that Codecademy reported ...

return number * number * number

You could do this instead ...

return number ** 3

But, after that correction is made, note that in the by_three function, there are issues in this line that need to be addressed ...

return by_three("cube(number)")

The instructions ask that you have it return cube(number). But, instead, you are calling the by_three function from within itself, and are passing it a string.


why in the second function, by_three is the second line -- if number % 3 == 0? how does this show that the number is divisible by 3? i understand the 0 would indicate that there is no remainder. is that all there is to it? for instance, 12 / 3 equals 4. would the return not be 4?


Hi, @clairethebear88,

Yes, if number % 3 yields no remainder, then number is evenly divisible by 3. Importantly, the converse is also true. If number is evenly divisible by 3, then the result of number % 3 is 0.

The result of 12 / 3 is 4, as you mentioned, but the result of 12 % 3 is 0. So, you could say that 3 divides into 12 exactly 4 times, and so leaves a remainder of 0. However, the result of 13 / 3 is 4 and the result of 13 % 3 is 1. In that case, you would say that 3 divides into 13 4 times, but leaves a remainder of 1.