So.... I tried to pass this lesson, but it gives me a strange error. Here's the code:

def cube(number):

return number ** 3

def by_three(number):

if n % 3 == 0:

return cube(number)

else:

return False

What should I do? I am tired.

So.... I tried to pass this lesson, but it gives me a strange error. Here's the code:

def cube(number):

return number ** 3

def by_three(number):

if n % 3 == 0:

return cube(number)

else:

return False

What should I do? I am tired.

The reason why you have that is because if you use cube(number)

it is actually looking for cube(n)

so change all the numbers to n and then it should work if not use my one I did

def cube(n):

cubed = n**3

return cubed

def by_three(n):

if n % 3 == 0:

return cube(n)

print "False"

else:

return False

print "False"

Stil not working. It gives me this error:

File "python", line 5

if n % 3 == 0:

^

IndentationError: expected an indented block

Just a guess but maybe because line 4 is asking for "if "n" % 3 " when you havn't specified "n" only "number".

I'm saying it again: it says "expected an intended block". So, I can't see any intended blocks.

seems like i get another error now. here's the code:

def cube(n):

return n ** 3

def by_three (n):

if n ** 3 == 0:

return cube(n)

else:

return False

and here's the error:

Oops, try again.

by_three(3) returned False instead of 27.

Done it! Here's the final code:

def cube(number):

return number**3

def by_three(number):

if number%3 == 0:

return cube(number)

else:

return False

You just needed to press tab. White Space in Python is important, and Python won't ignore if you use random whitespace or not enough white space. It's ignored in other languages (I believe HTML ignores it, for example).

I keep trying to organize my code like I do in HTML and it keeps hitting me with errors because of that.