6/19


#1
 def cube(n):
    n = n**3
    return n

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

returns with:

file 'python', line 8
else:
^
Syntax error: invalid syntax

Can someone help?


#2

Nevermind! I got the code ill leave it below for all of you.

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

#3

Thanks! It's helpful


#4

it worked for me and my classmates


#5

i know i'm a bit late but why did you write
print by_three(9)
at the end of your code? it worked for me but in the instructions they dont ask us to print anything at the end
thanks


#6

Hey,

Thanks for help.

But why you wrote print?