6 kyu
Missing Alphabet
466 of 1,164MicheleCarbone
Loading description...
Strings
Algorithms
Games
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.
python new test framework is required. updated in this fork
Approved
JS: Node v12 should be used along with its appropiate assertion tools (Mocha + Chai). Refer to this and this
JS: Should have more sample tests
Nice kata. Had to make several attempts at cracking this one, but got there in the end with a unelegant solution
Nice kata.
thank you kata sensei for comprehensive instructions.
A minor typo in the description:
The function should insert only after the first occur[R]ence ..
changed
Mistake in sample tests in Ruby:
I am unable to validate my solution: getting a tIDENTIFIER error on line 20, but my code is only 15 lines long. So maybe it's an error with the test?
main.rb:20: syntax error, unexpected tIDENTIFIER, expecting keyword_end
Are you sure your code isn't missing the
end
the error is about?Yes, I'm sure. My script runs on my system. I wrote it in my code editor then copied and pasted here. It is only 15 lines long, and includes all necessary closing
end
commands. So I'm not sure why they would register an error on line 20.There's a mistake in sample tests.
@mmanousos, click Attempt instead, or delete the red dot after the sample test and try again.
Deleted the red dot as suggested and now sample test passes. But Attempt fails on 1 basic test and 1 random test. I don't believe either failure has to do with my code, since both errors mention the
each_char
method and the random test error mentions thetimes
method. I used neither of those methods in my solution.For the basic test failure:
For the random test failure:
Looking at the tests I can tell that everything seems fine to me (especially when viewing tests requires completing the kata). So, I'm tempted to say that it's your code that isn't working correctly.
The last "l" given in the example of "holly" shouldn´t be also followed by the missing letters of the alphabets? Something like:
output="hIJKMNPQRSTUVWXZoPQRSTUVWXZlMNPQRSTUVWXZl + MNPQRSTUVWXZ + yZ"
Hope I didn´t miss anything.
No, it's already in the instructions:
Answered.
Damn, sorry. I missed that. Thanks Chrono.
Haskell translation
Please review and approve.
I'd love to see a haskell version since I accidentally solved it in Haskell.
Still waiting for approval of the translation. Hopefully soon.
Haskell is up.
This comment has been hidden.
Your code is wrong.
Not a kata issue.
It was marked as a Question, not as an Issue. About what
exp
is, it's the expected value (a string) calculated with a control function.This comment has been hidden.
This comment has been hidden.
That's the basic difference between fixed tests and random tests. With fixed input values, the expected values are also fixed, with random input values you have to calculate the output somehow, and store it in a var normally.
@heptapod, my apologies. Pls post your code here and will take a look. Remember to flag as spoiler.
@Chrono79 thanks for the explanations @KenKamau thanks for the offer. finally fixed it by adding many ugly conditionals and loops, my code was actually still very wrong, totally misinterpreted the error msg, so sry bout that. great Kata, seemed easier at first :)
I get a missing substring error here but a normal output with the same code in my own program. Is that a thing?
The error must be due to unwanted spaces.
C# Translation added!
.
Java translation added!
.
holly is not good example in descryption. two ll in 'holly' are misleading I thing.
did you mean that the specific letter "l" is misleading or that the repetition of a letter in general is misleading?
letter 'l' is misleading with I :)
I really enjoyed this kata and hope you'll create more!
Thank you! I'll definitely create some more :D
Ruby translation
Please review and approve.
.
Python translation
Please review and approve.
.
.
@KenKamau: Could you check your Python random generation string? It seems it could generate an empty string.
Nice catch. Fixed for both Ruby and Python.
Next time, please raise such as an issue so it can stand out and be resolved faster.
Approved :)
Thanks :)
10 Random tests is a bit spare. I'd suggest a 100.
Also needs better fixed testing with edge cases. I'd think an input string containing all letters might be an edge case - that one should definitely be tested. Odd and even numbers of occurrences of the same letter ( for people who are toggling presence of letters ). Any edge case that might come up from random testing ( with any solution ) should be added as a fixed test ( solvers should help you out here ).
Solved
The empty string has no occurrences of characters. So returning the full aphabet is illogical; returning the empty string would make much more sense. Current specification is in contradiction with the description itself.
Also, it's not even specified. Being a special case, it should definitely be in the description. ( Or expect
""
; then it conforms to the existing specification. )with what?
Also, input validation does not really add anything to the kata. Please just skip it.
Hi thanks for the feedback!
All solved
Hi Michele, enjoyed the Kata but I think you should add to the description the instruction to return the lower-case alphabet for an empty string, or a string consisting of just a space.
(To be honest, I'm not sure of the logic for returning the lower case alphabet, or why it needs to return anything other than an empty string? Don't know if it adds anything)
But yeah, maybe stick it in the description or at least the example tests? Thanks though.
This comment has been hidden.
Solved
Hadn't read this before posting above.
I just changed my vote on this kata.
If you willfully hide booby-traps in a kata, you're going against everything I hold dear. Specifications should be complete; there is no place for surprises.
Adding the
puzzle
tag feels quite misplaced on this kata. You're just unwilling to write complete specs, and it's unclear to me why. This is not a puzzle.JohanWiltink, i just thought that removing that detail from the spec would add a little more challenge/fun to the kata. I didn't want in any way to deliberately misguide anyone.
I thought it was a logical step to return the entire alphabet when an empty string is passed as input, but clearly that's not true for the people that are trying to solve the kata.
I'll change the spec.
At this point it does not make any sense to pass an empty string as input, i'll pass only lowercase letters.
Random tests expect
undefined
for empty string.This comment has been hidden.
Input validation tests should be put in the fixed tests: you're not guaranteed to generate such a test case in the random tests.
This comment has been hidden.
Hiding random tests is not considered good practice at all. It serves nothing but making code harder to debug.
I apologize, i didn'it on purpose. Now every random input will be logged as well as the expected result and the actual one.