Function Practice Makes Perfect Problem:


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

Connected to Codecademy

script.py

def cube(number):
return number ** 3
def by_three(number):
if number % 3 == 0:
return cube(number)
else:
return False
1
def cube(number):
2
return number ** 3
3
def by_three(number):
4
if number % 3 == 0:
5
return cube(number)
6
else:
7
return False
Your code looks a bit off. Check the console window for errors!
Run
File “python”, line 5
return cube(number)
^
IndentationError: unindent does not match any outer indentation level

This happens no matter what I try. It wants me to delete the entire line. What’s going on?


#2

Hi @cmf2k3, look here:

your if statement looks too indented which is throwing the error.

If that’s not the case, then unindent all of your code and indent the necessary blocks again.


#3

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