Ad
  • Custom User Avatar

    Your solution is failing because you are using a global variable counter to track the number of multiplications, and this counter is not reset for each test case. This causes incorrect results after the first run of the function.

    Your solution is wrong, and tests are not at fault of your problem. If it's not the first time you encounter such issues, it would be a good idea to review your method, and not just blame tests. The "I. wrote. my. solution. first. in. VS. Code. The. results. were. all. correct." does not mean that your tests were correct, because, appparently, they were not. You did not tests whether your solution can be used more than once, and as it turns out, it does not and it breaks after a single use. You need to fix it, and reconsider the attitude of "EVERYTHING IS BROKEN!!1!1!".

  • Default User Avatar

    Thank you!

    I appreciate the heads up, and I'll try to fix the code.

  • Default User Avatar

    You asked for a glib remark when you blamed the tests before having understood what happened ;)
    Your code doesn't pass the example tests, and you can find those below the editor.
    "Works on my machine" just means you didn't test the thing that failed.
    If you still fail to reproduce those tests locally, then debug it in the codewars environment. I did look at your code and it is your code that is the problem, not the tests. Write it a little better please.

  • Default User Avatar

    Have you actually read my entire comment, or have you just read the first few words and decided to be a wise guy?

    I'll explain it slowly.

    I. wrote. my. solution. first. in. VS. Code. The. results. were. all. correct.

    So now explain to me please - how come the code works correctly in one place, but not in another? Does that even make sense?
    Maybe I'm missing something here.

    Now's your chance to actually be helpful instead of being smart alec.

  • Default User Avatar

    Ain't a great look to blame tests when your code is wrong xD

  • Default User Avatar

    The tests for this task aren't written correctly.

    I wrote my code for this in VS Code, called the function with the test data from the kata and some other inputs as well,
    and the return value was exactly what's expected.

    This was not my first task in which it happened, by the way.

    Write your tests a little better, please.

    Thank you!

  • Default User Avatar

    done

  • Custom User Avatar

    Thank you so much!

  • Custom User Avatar

    Quite a lot.

    • Your function is named "func", when it should be named "persistence"
    • Your code is not formatted. See https://docs.codewars.com/references/markdown/#code-block
    • A bunch of logical errors: Your loop will only run once, but it should run until there's a single digit number remaining. Also, you're returning (or trying to) the final digit itself, but you should return a number of steps it took to reach that digit.
  • Custom User Avatar

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

  • Custom User Avatar

    Your code sometimes doesn't return a boolean value, that's your code's problem and not a kata issue, please read this: https://docs.codewars.com/training/troubleshooting

  • Default User Avatar

    I get an error which says Failed asserting that null is identical to true in php

  • Custom User Avatar

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

  • Custom User Avatar

    kata was retired

  • Default User Avatar

    Already I think I managed to fail this. I just started copying the same sequence of numbers and words from the Sample Area below to see what would happen.

  • Loading more items...