```
def cube(number):
return (number, cubed)
def by_three(number):
if n % 3 == 0
return n % 3 = cube(number):
else: by_three = False
```

# Why wont this work?

**stetim94**#2

because this code is full of syntax errors?

a cube of a number is to the power of 3 so for example:

`3 ^ 3 = 27`

you have to write this in programming syntax, and then return it. That is your cube function.

then here:

`if n % 3 == 0`

missing colon at this line, and where is `n`

coming from?

can you provide the exercise url? i need to see what needs to be done

this line:

`return n % 3 = cube(number):`

the indention is of, the syntax looks weird. the remainder of n divided by 3 should get a value of cube number, that is not possible. you can assign like that. What is the colon doing in this line?
here:

`else: by_three = False`

you set a function to false?

**stetim94**#4

i was right here:

apply this change, and this one:

then here:

`return n % 3 = cube(number):`

this line should be inside the if clause (indention), and `return cube(number)`

then here:

`else: by_three = False`

you should return false, not set the function to false

If you nee more help, post an updated version of your code

**stetim94**#6

it is technically not wrong, but having 4 spaces indent in cube and 8 in by_three is not neat either, but then specify it as recommendation.

no, you can do:

`else: by_three = False`

python allows for this, if you have a single line for your else clause, you can put it on the same line as the `else`

keyword, if you wanted to you could even do:

`return False if n%3 else cube(number)`

perfectly valid, even shorter and even less lines

**system**#8

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