Ad
  • Default User Avatar

    I'm new to programming and if I'm wrong please someone correct me!

    I believe it's because it's being considered to be null terminated strings.
    Therefore the last character of these strings are '\0', but in a empty string this would be the only character
    and when we compare it with a string that isn't empty it would return true since '\0' is present in both.

    But as far as I understand it isn't something that will be printed in the screen, just something that will be
    considered by the machine.

  • Default User Avatar

    How could this pass the test while my first try failed?
    This should report an error with empty input of s2,
    when you try scramble('r',''), this code return True while it should be False.

  • Default User Avatar

    Thank you for your kindly reminding and reply. I figured it out eventually and passed the test.

  • Custom User Avatar

    Again is it really an issue? From this text it doesn't seems so. But anyway, it's your post, I won't mark it as resolved (but I can't say someone else won't either).

  • Custom User Avatar

    I see what you're saying, but I think that the inability to fix the issue because of rules imposed by factors outside of the katas control doesn't mean the issue has gone away or should be marked resolved. It helps to inform subsequent users that there is something amiss.

  • Custom User Avatar

    Once a kata is solved more than 500 times in a language the tests are locked in that language. It's been discussed if this can be changed in the future but right now, that's how it is.

  • Custom User Avatar

    True, but other comments allude to more thorough testing in other languages this kata is available in. I think one comment even mentioned random tests. I've only completed in JS so cannot verify how far true that is though.

  • Custom User Avatar

    It seems to me this should be a suggestion, not an issue. See the kata creation date, it's from 2013, so old katas are probably overrated.

  • Custom User Avatar

    I guess you're talking about Python (always state the language when the kata has more than one). We need to see your code formatted in a post marked as having spoiler content to help you. More than 1900 persons passed in Python so it's more likely your code what's wrong.

  • Default User Avatar

    I copy the code to my computer and works well:
    My code test:
    solution("apples, pears # and bananas\ngrapes\nbananas !apples",['#','!'])
    'apples, pears\ngrapes\nbananas'

    However, failed in here with the exactly same input arguments, which reported:
    'apples, pears\ngrapes\nbananas !' should be 'apples, pears\ngrapes\nbananas'

    Apparently, there exists an error caused this. Please check!