# Practice makes perfect error!

#1

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.

#2

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"

#3

Stil not working. It gives me this error:

File "python", line 5
if n % 3 == 0:
^
IndentationError: expected an indented block

#4

Even yours doesn't work. I don't know why. I tried all the possible solutions, nothing.

#5

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

#6

and...... how should I write then?

#7

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

#8

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.

#9

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

#10

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.

#11

yes u r right....White space,guys and organising functions

#12

I'm starting to hate python........

#14