6/19


#1

This is the function I wrote, I keep getting a IndentationError at line 5: expected an indented block. Please help me sort this out.

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


#2

Please re-edit your Post

  • select your code in the Post
  • then =click= on the </>-symbol-of-this-editor

Your code will then be in a pre-code state
and you will be able to make/present the proper indentations.


#3

This is my result and it came correct:
def cube(n):
cubed = n**3
return cubed

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


#4

This is what I used and I got it correct. Indentation is pivotal to correct coding.

def cube(number):
return number ** 3

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

Hope this helps.