Practice makes perfect--PLEASE HELP thanks


Please help me. Thank you.



I don't know what your aim is... Do you mind explaining that or giving a link to the exercise?

To fix the current issue, here you go:

def cube(n):
  return n**3
def by_three(n):
  if n%3 == 0:
    return cube(n)
    return False
print by_three(9)



You will notice I place your intended n value in the parenthesis while calling the by_three function, which is the right way to do it.


his way is the right way too :grin:
doesnt matter if you pass a literal or a variable as argument

it seems you run into a glitch, try to reload the webpage
your code is absolutly correct



It would be great you first read my whole comment and not jump in...


Well well well, have the stage.

Thank you! :slight_smile: :slight_smile:


Thank you very much! I fixed it :slight_smile:


Hello there!

One question, why do you need to write the argument:
if n%3 == 0
instead of:
if n%3



Sorry this is coming late.

We need to have it as if n % 3 == 0: because we are trying to confirm that the value of n when divided by 3, will give no remainder; meaning that it is exactly divisible by 3. Writing it as if n % 3: will return an error because this in itself is no condition.

== is used for value comparison.
=== is used for both value and data-type comparison.

I hope this helps! :slight_smile:


Worked truly awesome. Nice work!



You're welcome. Have fun coding. :smile:


Quick question, why does blood taste like metal (Coins).


And what does an apple taste like?


Haha... I honestly haven't given that a thought. :wink:


:smiley: :smiley: :smiley:


Lol we've got a lot of iron in our red cells, that bind with hemoglobin.


How do you know to set the value n to 9? Or can you just pick any number that is equally divisible by 3?


Hehe I knew that. I was just asking questions, like "What's the color of GREEN"


Chlorophyll, quite often. But sorry - we've drifted off-topic, counter to the guidelines, unless we do this ...

green = 0x00ff00 # hexadecimal for green
print by_three(green)

Output ...


Evidently, green is divisible by 3, and therefore it got cubed. :smiley: