# Practice Makes Perfect - Why is my code not working😞

#1

Hello,
My name is Kiran and I don't know why my code isn't working.
I have checked the hint and literally copied the code it gives me and changed the 'prints' to 'returns'- I don't think it is this the problem though, as the error message says nothing like 'Oops, did you 'print' instead of 'return'?'. I think it has something to do with the function's argument.

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

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

I would be very thankful if somebody can help me.
From Kiran

#2

On this line remove the parentheses ()

And here,

If your argument name is number use that to check if the number is divisible by three.

#3

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

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

(It is okay if I put `n`. Doesn't make a difference.)

So, don't put the`()`.

Have fun coding

#4

Many thanks!

#5

No problem. Happy coding

#6

That worked perfectly! Thanks candycornlover1!

#7

No problem just remember those little things can make your code go really wrong.

#8

Thanks I appreciate it heaps for helping me out, people like you who willing help really make a difference, I'm sure you inspire many, hope your having fun coding (and helping others code), enjoy that rest of your day (or night).

#9

No worries! Have a good day too! Or night

#10

def cube(number):
return number ** 3
def by_three(number):
if number % 3 == 0:
return cube(number)
else:
return False

That's what I got and it works. (You have to add the white spaces before the return on line 2, a white space before if, two whitespaces before the return on the sixth line and one whitespace before the return on the last line.

#11

Steven

#12

Yeah, but I did explain what she did wrong. I just put what it has to look like.

~ Candy

#13

Aha that is true! You are right

#14

Thank you. But I should take your advice and explain more. I will do that more often.

~Candy

#15

I wanted to know. Do you know what flag means?

#16

Here look at this website. IT really helped me.

#17

thanks @candycornlover1

#18

No problem.

#19

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