# If that number is divisible by 3, by_three should call cube(number) and return its result. Otherwise, by_three should return False

#1

def cube(number):
return "number **2"

def by_three(number):
if number / 3:
print "number is divisble by 3"

else:
print "number is not"

#2

Please post your code and the problem you're having with this lesson.

#3

how do I return a def function

#4

Currently, in your cube function, you are returning a string. Remove the quotation marks around `number ** 2`.

In your def by_three function, you should use the modulo `%` instead of division `/` as it will give you the remainder. In order for a number to be divisible by 3, you need to see if the remainder of number/3 is 0. That's where % comes in handy.
`number % 3 == 0`.

In the instructions, it states that if the number is divisible by 3, you need to return the result of its cubed. Meaning, you need to call the cube function in your `return` statement.

Otherwise, `return False`. In which False is a boolean. Don't return a string.

Make sure you indent properly and read the instructions carefully.

#7

When I test your code, after adding indents in proper locations, it says this error:

File "python", line 7
else:
^
SyntaxError: invalid syntax

Any idea why?

#8

If you are struggling, make a new topic so someone can help you. This topic is for helping jbolano28848

#9

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