• Read the post below, it's the same question.

  • why does the test aproves my solution but the attempt keeps denying it?

    • TEST runs your code against preliminary cases to give you an idea of (mostly) what to expect. But make sure you understand the full requirements of the kata before ATTEMPT, because then your code will be then tested against additional tests, often some being different than before, and you should expect random tests as well.
    • expected '10011000001100101000110111100110' to equal '100001101111110001010011000001100101000110111100110' means you returned the first value shown, meanwhile the test requires your function to return the second value shown
  • Can someone explain to me how I am passing the test and yet failing the attempt. The error code isn't making sense either.

    Error Code
    It should work for random inputs too: expected '10011000001100101000110111100110' to equal '100001101111110001010011000001100101000110111100110'
    If u can help i would really appreciate it.

  • Instead of printing the result try returning the result.

  • "Binary Addition" PHP Translation, to be evaluated

  • Maybe, but the kata isn't python specific. In fact, this represenation (as string) makes little sense in other languages (IMO).

    Newbies (and possibly other users too) do not know, and do not care, about other languages. I can see no way which would lead someone to think "yeah 0b11010101 looks reasonable to me, but definitely not what C++ folks would expect". We cannot expect users to know multiple languages so they can figure out what's correct and what is not.

    There are sample tests that show how result should look like, and also you have assertion messages which would quickly show the expected result.

    While true, I think it's somewhat too late. If failure can be prevented, then why not?

    I will try to add some examples to description later.

  • Well, at least having an example in the description would be nice

    Agreed.

    I can see how for a python newbie the result of "0b1101011" can be seen as valid

    Maybe, but the kata isn't python specific. In fact, this represenation (as string) makes little sense in other languages (IMO).

    will a 7 kyu interpret it as an 'incorrect' result without being told so?

    There are sample tests that show how result should look like, and also you have assertion messages which would quickly show the expected result.

    probably explaining why the discourse is so large for this low level kata

    Considering there's ~70k completions, this is fairly low amount of discourse. If you want a proper example, take a look here: https://www.codewars.com/kata/550498447451fbbd7600041c/discuss :D

  • Thank you, that's essentially what I would like to see edited into this kata's description - even if it's something like 'return the string from the third value onward'. That introduces the element of counting from 0 (return index 2 onwards, not 3), which I think will lead to an additional method of learning for new coders

  • Well, at least having an example in the description would be nice. I can see how for a python newbie the result of "0b1101011" can be seen as valid.

  • That's the thing, will a 7 kyu interpret it as an 'incorrect' result without being told so? I don't think they will, instead they'll return incorrect results and not be entirely sure why (probably explaining why the discourse is so large for this low level kata)

  • Prolog translation available. (author is long gone)

  • Well that's specific to python and one of its methods. Plus, this being 7kyu is no excuse for returning incorrect results.

  • Need to specify the need to return only [2:] onwards, this will trip people up for no good reason at 7 kyu

  • Loading more items...