Please leave the following link in the post so we can find the unit module, else replace it with a link to the exact lesson:

https://www.codecademy.com/courses/learn-python/lessons/functions/exercises/practice-makes-perfect?action=resume_content_item&link_content_target=interstitial_undefined

# Does the function exercise asking users to find the cube root want an if-else sstatement for both functions?

**jacquesk**#1

**mtf**#2

No. Only the `by_three`

function has a conditional. The `cube`

function is pure. Value in -> cubed value out.

**jacquesk**#3

```
def cube(number):
return number ** 3
def by_three(number):
cube(number)
if number % 3 == true
return cube(number)
else: return Fale
```

In regards to strict equality (===)

Why does the hint state:

```
if n % 3 == 0:
print "n is divisible by 3"
else:
print "n is not"
Make sure both functions return their values rather than printing them.
Both branches of the if/else statement in by_three need to have return statements in them (that's three returns total, two for by_three and one for cube).
```

Most importantly, did I call the function within a function the right way - I undertand there are no global variables in python.

**mtf**#5

That line can be removed.

Missing colon to open code block.

Missing indentation.

Misspell… `False`

We call a function from within a function the same as we would in any situation. What is happening here is,

```
1. call to cube with number as argument
2. cube function returns a cubed value
3. by_three function returns that value.
```

There are globals in Python, but prudent writing avoids the use of them as much as possible.

Aside

```
if something == True:
```

is the same as,

```
if something:
```

When `something`

evaluates to True (or is a boolean already) it will pass.

**system**#6

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