Someone explain the warning stated


1)def by_three(number):
return number **3
o/p: 0
Also it says "oops try again. by_three(1) returned 1 instead of False


Have you considered what you want them to be doing? Have you considered what chain of events would have to take place to obtain the desired result? Would you argue that each of them implements that chain of events? Can you motivate why either of them would have the desired effect? What do they really look like? It's uncleare where they start and stop and they're both invalid syntax, make sure it's very clear what the two pieces of code are - just cleaning up the formatting might make it easier to tell by yourself what is different about them?

There's no good way to respond to what you're asking. You would need to refine your question.


In your code you have added a condition if(number%3==True): change it to 0.
You may try following code:

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


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