# Functions section 6 Practice makes perfect

#1

I'm close but I don't understand what I'm doing wrong. The error message states that by_three(3) returned true instead of 27. May someone please tell me where I'm going wrong?

``````def cube(n):
return n**3

def by_three(n):
if n % 3 == 0:
return True

else:
return False``````

#2

from step 4 of the instructions:

if that number is divisible by 3, by_three should call cube(number) and return its result

you only return true, you should return the cube of the number (careful, in your case the number is in the variable `n`)

#3

Why is it necessary to have " 3 == 0?" Specifically the ==0 piece.I am interpreting this as IF number divided by 3 equals 0 then return cube of that number....How should I be interpreting this line? I didn't have it in there before but after reading the questions above I am now curious. Thank you for any insights anyone can provide.

#4

well, in the end it matters if the condition evaluates to true, if this happens via comparison or simply evaluate a number, doesn't matter.

but then its important to understand this:

``````if 1:
print True
else:
print False
if 0:
print True
else:
print False``````

so, `1` is true, and `0` is false (2 is also true, positive integers are evaluated as true)

so, you can do without `== 0` but then for numbers not divisible by three if condition would be true, so you need to return False and else (number is divisible by 3) cube of number