Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • Re-posted as an issue.

    BTW there's sample test with 'y' which should give a hint, but I agree that 'y' being/not being a vowel can come as surprise for people using different languages.

  • Since notion of a vowel is ambiguous, description should explicitly state what is considered vowel by this kata. Otherwise it raises doubts and misunderstandings (see @mpotoczny's post below).

  • It would be helpful to mention in description that 'y' is not in vowels. I spend much time trying to solve this kata and using vowels "aeiouy". Then I figured out that solution works without 'y', so there was not issue with my code but rather with not precise description.

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

  • The parameter name is shadowing a built-in in Python.

  • Then, please, explain why when I add 'twoo' to be replaced by 2 as elements to my dict along with 'two' - the function ,on average, passes more random tests? For example - 9 vs 3 if I wouldn't use 'twoo'

  • No, logically, you should be replacing two for 2, what's next doesn't matter, being it an o or other char.
    If the string was twoo you replace the two by 2 and end up with 2o. Understood?

  • Well,logically, "twoo" should not be replaced by anything

  • There is no such case and two should be replaced by 2. The first one is what your function returns and the second is what it should be returning, the problem is in you code.

  • 'W2woWt2t2wTTXwWOOOxoT2wt' should equal 'W2woWt2t2wTTXwWOOOxoT2owt'.'twTwwOtXOtwXtXwWX2WXw' should equal 'twTwwOtXOtwXtXwWX2oWXw'. The issue raised by Johan still persists. Please, remove the test case where string "twoo" has to be replaced by "2" because it causes ambiguity.

  • That's weird - I was under the impression that CodeWars only invalidates existing solutions when you add new fixed tests, not new random tests. Well, if it works, don't fix it. :]

    But generally, because of this behaviour and because you can't rely on random tests generating particular edge cases ( unless you code it like you did of course ), it's better to add fixed tests for particular edge cases. That way you know they'll be tested, you can give a specific failure message if you want, you don't have to complicate the random generator, and CodeWars will invalidate incorrect existing solutions. Again, I can't explain why it apparently will do so with a random test in this case, sorry, I've learned to cater to it is all.

    I noticed a solution that uses a regex /to+/ BTW. I think there should be a test ( I was gonna say a fixed one :P but I don't dare anymore ) with "tooo" having to become "2o". That should invalidate that incorrect solution ( and there may be more like that, I haven't checked ).

  • Loading more items...