Practice Makes Perfect (Functions) Codecademy


#1



https://www.codecademy.com/courses/python-beginner-c7VZg/1/5?curriculum_id=4f89dab3d788890003000096#


File "python", line 8
else:
^
IndentationError: unindent does not match any outer indentation level


It says that else is incorrect. I'm not sure what to fix. This is what I have:
Also, before I used this hint. I highly appreciate it I someone can help me. :slight_smile:


Replace this line with your code. 
def cube(number):
    return number**3
    
def by_three(number):
     if (by_three):
       return cube(number)
        
    else:
        return False


#2

Hi @ahewage,

The indentation of this if header should be reduced so that it is the same as the indentation of the matching else header below it ...

     if (by_three):

Also work on the indentation of the two return statements to make the code neater.

You also need to revise the condition in that header. The line should be ...

    if number % 3 == 0:

#3

Ok! Thank you very much @appylpye !
Have a great day :grinning:


#4

def cube(number):
return number**3

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

else:
    return False

#5

It works!!!1 :grinning:


#6