6/19 help!


#1

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

why i get this ?
File "python", line 5
if number% 3 == 0:
^
IndentationError: expected an indented block


#3

Hi, @luigi_foll,

Because your code is not formatted, it is difficult for other users to read and debug it. As code is being posted, you can format it by selecting it, and then by clicking the </> button above the editing area. This will enable us to see important details, such as the indentation and underscores.

As the Python interpreter reported, you have an IndentationError. Evidently, the if block header was not indented, but it needs to be indented, in order to make it part of the by_three function.

Following is the by_three function with the indentation added:

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

#4

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??


#5

Dear sarah,
the problem it is that with python you need to pay attention to the format. So
if number% 3 == 0:
--------return cube(number)
else:
--------return False

so if and else need to be on the same axe and so 2 returns. (don't pay attention at the score i put just so to show up the format)


#6

thanxx luigi_foll ! :blush: