6/19


#1

def cube(number):
return number**number
def by_three(number):
if number% 3 == 0:
return cube(number)
else:
return False
why am i getting tis indentation error ??
File "python", line 2
return number**number
^
IndentationError: expected an indented block
can any1 help??


#2

It is really hard to resolve a indention error if you don't use format, you didn't use format, so now your indention is gone, use the following steps to post code with indention:


#3

Hi sarahsuhail,
First of all, you wrote number**number instead of number**3. number**number will give you number**2, which is not what you want.
The reason you are getting the error message is because you haven't indented your code correctly. You need to indent 'return number**number.' To do this, either press the tab button at the beginning of the line, or press the space bar 4 times. The lines that you need to indent are:
return number**number
if number% 3 == 0:
return cube(number) (indent this block twice)
else:
return False (indent this block twice)

below I have the code that I used, and that worked for me.

def cube(number):
return number**3

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


#4

thank u annafh2002 !


#5

thanxx stetim94 ! :blush: