Practice Makes Perfect || Help please


"Oops,try again. by_three(1) returned 1 instead of False"
"None" in the console window

I'm not putting in a by_three(1)

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


That is the way that codecademy checks sometimes. It will plug numbers into your function and check the output to see if it's right. Let me ask you this though: if number % 3 == ...?


Still didn't work when I put that in


Don't type that exactly. I'm asking what would number % 3 be equal to if it was evenly divisible by 3? Any number divided by three with 0 left over.


Not following you here. I'm piggybacking on the thread to get a hint too


If we want to see if a number is evenly divisible by another number, when we divide, there will be no remainder. Since % returns the remainder from division, if we check to see if the answer is 0, then we can evenly divide it.


if 30 % 2 == 0:
    return "The number is divisible by 2 evenly. It is therefore an even number."


Got it to work.
Ended up putting in:
def cube(n):
return n**3
def by_three(n):
if n % 3 == 0:
return cube(n)
return False


def cube(number):

  return result

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

return False

Please help me, there's an indentation error in this code



Return result needs to be under result=number**3.

I hope that helped. Try to remember that python uses indentations to put code into blocks.


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