Functions.S7!Please check my code


#1

Here is a link to the exercise.
https://www.codecademy.com/courses/learn-python/lessons/functions/exercises/practice-makes-perfect?action=lesson_resume

Here is the error message:
File “python”, line 5
return cube(number)
^
IndentationError: unindent does not match any outer indentation level



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



#2

Hi @dextren5, look here:

Did you see the error? Python is saying that return(cube) (and return False) doesn’t match any other indentation level.
Have you read on indentation/white space? What we want to execute --if true-- should be indented under our if/elif/else statements. Do you know what I mean?


#3

Thank you! I can’t believe I missed that…I feel stupid.Indentation AFTER if/elif/else!


#4

Sure you’re welcome. Don’t feel stupid, we all make mistakes sometimes :wink:


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.