Practice Makes Perfect


#1

def cube():
number(3)
result = number**3
return result
def by_three():
number(3)
result = number % 3
if result == 0:
return result
else:
return False
Error:
File "python", line 7
result = number % 3
^
IndentationError: unindent does not match any outer indentation level


#2

This worked for me:

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

def cube(n):
    pow_three = n**3
    return pow_three

by_three(11)
by_three(12)
by_three(13)

#3

I am curious what is the by_three for?


#4

Arnt you dividing something by three? (Sorry, I did this exercise a LONG time ago.)


#5

I defined the number then told the console to divide.


#6

Try my code? :grinning:


#7

I did thanks I understand how it works now.


#8

Glad I could help. :slight_smile: