Ad
  • Custom User Avatar

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

  • Default User Avatar

    Thank you for taking your time and comment this, it teached me a lot.

  • Default User Avatar

    Excuse my ignorace but why is this not best practice? it seems clear to me what it does...

  • Default User Avatar

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

  • Default User Avatar

    for example $"hello" it was taken as a normal string

    There are no variables there so, yes, just letters h-e-l-l-o.

    If you print things out from your code to observe what steps are carried out, you can figure out what went wrong.
    For an input of "testing", you get a result of "e" which definitely isn't in the middle. So, which string did you use to find an 'e'? And which index was used? There is an 'e' in that string, so if it's the right string then the wrong index was used. Or if it's the right index, then it would be that the wrong string was used. One or the other.

    When you dig into things and find out what's happening, there is no longer such a thing as a stupid mistake.

    And yeah, you weren't testing the case that the code failed on. "testing"

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    What makes you say $"" doesn't work? Did you read the error messages that you're getting?
    I assume you're using C#, $"" works just fine.
    When you test things locally, make sure you're testing exactly the same thing as is failing here. Usually when I see somebody say "it works in my environment" I assume they didn't test the thing at all, so therefore there was no failure. You could for example copy the example tests and run them, and if something in the real test cases is failing, you could add those to the example tests that you copied.

  • Default User Avatar

    interpolation $"" does not work here, so I do it without it and it still doesn't work. I used the test cases and my code works just fine in VS but when I run it here I get errors

  • Default User Avatar

    Sorry for the necroing here!. I've been using my method of doing "for each (char digit in List) { List.Add(digit - 48) }" to separate each number for several katas now, then I saw this solution and thought "Gotta do it that way now!!!" then saw adams85's comment and thought "goddarnit". I had already noted the code down, happy to being able to do better next time so that was such a shame. Then saw yours and hope came back to my soul, thank you, stranger.

  • Default User Avatar

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

  • Default User Avatar

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