so im on Practice Makes Perfect lesson on functions. and im not sure how to do what it asks, this is what i have:

def cube(n):

return n**3

def by_three(n):

if n % 3

so im on Practice Makes Perfect lesson on functions. and im not sure how to do what it asks, this is what i have:

def cube(n):

return n**3

def by_three(n):

if n % 3

This exercise uses an `if..else`

statement to return either the cube of a number, provided the number is divisible by 3, or False. How would you write such a statement.

Bear in mind that a return value can be the return of another function.

`return other_function(number)`

this is what i have now:

def cube(number):

return cube(number)

def by_three(number):

if n % 3 == cube(number)

else:

return False

def cube(number):

return cube(number)

def by_three(number):

if n % 3 == cube(number)

else:

return False

idk what to do in the practice makes perfect lesson this is what i have:

def cube(number):

return cube(number)

def by_three(number):

if n % 3 == cube(number):

return True

else:

return False

cube(10)

Close but not quite.

```
if n % 3 == 0: # test for even divisibility
return cube(number)
```

To run the function, call it by the correct name:

```
print by_three(18) # 5832
print by_three(16) # False
```

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