Practice makes perfect


#1

i am getting the error
File "python", line 5
def by_three(number):
^
IndentationError: unindent does not match any outer indentation level

Below is my code

def cube(number):
    number =  number ** 3
    return number

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

can someone please help me in this?


Practice Makes Perfect error msg
#2

can you use markup to post your code (use the backticks):

Without markup, it is impossible where your have an indention problem

or upload a screenshot


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

#4

are you changing the indention when posting the the forum? Can i see a screenshot?


#5


#6

weird that it gives the error message on line 5.

line 1 and 5, why do they have 4 spaces as indent? This lines shouldn't have any indent at all


#7

True, If i am indenting it , it is giving me the following error.


#8

line 5 shouldn't also have no indent? Since you want by_three to be after cube, not part/inside cube


#9

You are good to go, just check the space once again.


#10

Yes, Thanks It's working now.


#11