5 kyu
Typoglycemia Generator
240 of 847trip
Loading description...
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Nice kata, well done.
This comment has been hidden.
:There are many errors in the solution to the last sample, indicated by '*':
Seems correct to me. ex "love", first letter "l" and last letter "e" dont change, "ov" sorted alphabetically is, well, "ov".
Great kata!
in the following test cases:
scramble_words('-dcba') == '-dbca'
as first char is "-" and last "a", shouldn't return value be "-bcda"?
scramble_words('dcba.') == 'dbca.'
as first char is "d" and last ".", shouldn't the return value be "dabc."?
Since the first and last characters remain in original place for each word. Thanks for any clarifiaction.
It would be nice if there was an additional test case that deals with words that have both a leading/trailing special character and an internal special character. None of the current test cases deal with this scenario but it comes up in the random tests.
Python new test framework should be used (Refer this & this for more detail)
Ruby 3.0 should be enabled (Refer this & this for more detail)
Done for Python.
Done for Ruby, in this fork
Nice kata:)
This test failure is a bit confusing to me, given that the kata description requires that we keep the punctuation in its original location, which is opposite to what this expected value would suggest. It looks like these 'random value' test cases are expecting all the punctuation to be deleted.
Are we supposed keep punctuation in its original location in some situations, but not others?
I'd love to know if there's something obvious I'm missing in my understanding of the problem so I can solve the problem properly. Thanks! :)
TEST: "Testing for "you're codewars blink, eat jiggery-pokery callipygian four dice in"
It should work for random inputs too -
Expected: "yorue cadeorws bilnk eat jeeggikoprryy caagiillpyn four dcie in",
instead got: "yor'ue cadeorws bilnk, eat jeeggik-oprryy caagiillpyn four dcie in" "
I had the same problem: Try to refactor your code and remove any mutating method that you called on the object referenced by the input string. Use non-mutating methods instead and try again. Hope this works!
This comment has been hidden.
It's it not possible to use the string.matchAll function in this compiler? I got "TypeError: word.matchAll is not a function" when calling a matchAll function. It's kinda tricky.
The maximum version of Node.js available in codewars is currently 10.x. matchAll support was only added in Node.js v12.0.0.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/matchAll#Browser_compatibility
Thanks PetrSr!
I dont understand what critera the full setences are supposed to be sorted under. They don't seem to follow the rest of the guidelines in the test cases.
I can't complete this one because something strange happens when switching between the static and random tests. Somehow my code seems to try to call a str.
Not kata issue ;-)
Not a clear enough description of how the scrambling should handle symbols, e.g. I expected -dcba to scramble to -bcda instead the solution wanted the first 'alpha character' to remain in place not the first 'character' to remain in place.
Must handle special character at the start is not specified in the instructions I would expect -dcba to equal -bcda
Thank you for the suggestion. I have updated the description to be clear and added the example.
Thanks for the kata; I have just translated it into both Ruby and Python, if you wish to approve them :)
May I add my random tests to the JS version too and suggest to use the .assertEquals method instead of "expect", as it gives much more informative error messages?
Thanks for the suggestions and go ahead with the random tests. I have updated the tests to use .assertEquals and approved the translations.
Done: notice that you can change the range of random words used by simply adding/editing the
base
variable in all 3 languages even if you could not code a line in either of the one I added.Of course, feel free to make all the test runs you wish and to let me know if you think I can fix or improve something up to your standards :)