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) else: 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
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 very much! I fixed it
One question, why do you need to write the argument:
if n%3 == 0
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!
Worked truly awesome. Nice work!
You're welcome. Have fun coding.
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.
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)
green is divisible by
3, and therefore it got cubed.