Ad
  • Custom User Avatar
  • Custom User Avatar

    You're not returning anything and you're redeclaring the variable upon each loop ~~

  • Custom User Avatar

    Yes. But as you see, you could solve it from your code, the tests were ok.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    If you get that error, you didn't even defined the function.

    def hello(name):    # you need to do some change here too
        pass            # you need to write your code here
    
  • Custom User Avatar

    I tried it and I got "NameError: name 'hello' is not defined", I don't know how that could help me.

    What else can I do? I can only code what my fucntion should do, if the content of my function cannot help with this issue there's nothing left do d, since I cannot modify the test itself.

  • Custom User Avatar
  • Custom User Avatar

    Please, listen me once again: for the time being, it appears that it is NOT a kata issue. Checking for an empty string in solution IS NOT enough, your solution has to do SOMETHING MORE to account for this case. Your solution is incomplete, that's why it fails.

    Also tell me if you did what I asked you: on your machine, in your IDE, call your solution like this:

    hello( )

    and see if it passes. If it fails, it means you need to add something to it. BUT if it indeed passes on your machine when called in this way (without parameter), but fails on Codewars, then it indeed is kata issue. In such case, we'd ask you to post your solution (hee here how) so we could pinpoint the problem. But for the time being, it seems to us that your solution is invalid, it is missing one special aspect, and it will fail not only on Codewars, but also on your machine, in your IDE, when called without parameter.

  • Custom User Avatar

    I tried it as you advised, but the error I got does not tell me anything

    "NameError: name 'hello' is not defined"

    So if there's no problem with my code since it checks what should be checked than how can this not be a problem with kata?

  • Custom User Avatar

    It IS a kata issue, even if your code checks for an emtpy arg it still raises the same error.

  • Custom User Avatar

    So why is my code not working? It is checking for empty argument, as you can see it shoudl return 'Hello, World!' if there's no argument passed so it should work just fine.

  • Custom User Avatar

    No, it's not kata problem. Really, it's not. Seriously. All the tens of answers below which say it's not a kata problem are true. Really really.

  • Custom User Avatar

    Because checking in your code is too late. Error occurs at the moment the function is called (at the calling site), before your check even happens.

    Serious question though: did you try to call your function locally, in your IDE, in the same way the test suite calls it? something like:

    msg = hello()
    print(msg)
    

    Try this and you will see your solution does not work.

  • Custom User Avatar

    So why do I get the same error even though my code checks for empty argument?

  • Custom User Avatar
  • Loading more items...