7 kyu
Substring fun
3,038 of 5,575philb56
Loading description...
Arrays
Strings
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.
Good, but it is 8 kyu
Java translation
approved
This comment has been hidden.
COBOL translation (author inactive).
approved
C translation (author gone)
Thanks :)
As I have successfully tested my solution on test, I received error, when sent my solution to check. Traceback (most recent call last): File "main.py", line 2, in import codewars_test as test ModuleNotFoundError: No module named 'codewars_test'
Switch to another python version.
Thank you very much! Your advise works for me)
No random tests.
Added random tests to Ruby & Python. JS and coffee is still lacking
There is a single random test in js and cs.
To describe the assignment a bit better:
You want to create a function that takes an array of strings as arguments(all strings inside the array have the same length), and wants to create a new string that consists of the nth value of every string.
So to give a clear example: if the array of strings is [hat,pun,leg] the required output will need to be "hug". (first value of array1 "h", second value of array2 "u", third value of array3 "g")
Hope this makes things clearer
thank you.
Thanks for clearing this up. Strings' lengths aren't necessarily the same.
Also, agree that the description is too ambiguous, and the test cases don't really make the assignment clear either.
Updated the description
Kata description isn't clear. Example Tests is too poor.
Updated the description
More test cases.|| More test Example.
Will make it better.
I just Kumited a Ruby translation.
Let me know if you'd like any changes in either translation.
I just Kumited a Python translation. (Who concocularied 'Kumite' in the first place?)
The description states:
This implies
n
is the length of the array (the number of words). The next sentence asks you to:However, the test case provided and the tests used don't actually check for this, but instead expect the ith character from each word (where
i
is the word's position in the original array).Following the kata description and the provided test case of
nthChar(['yes', 'yes, 'yes'])
, I'd expectn
to be3
(since it is an array of3
words), and thus the solution to be the3
rd character from each word (s
in this case). However,sss
is not the expected value.Thanks #SaladFork - I have amended the description to remove the ambiguity
Suppose, the input is nthChar(["yes","no","m"]) then output is : "youndefined", light should be thrown upon the fact of the words having length in increasing order
Thanks normalalien - I have modified the description accordingly
This comment has been hidden.
Perhaps "You must concatenate the nth letter from each word to construct a new word which should be returned as a string" would be better?
Thanks Thomas - I will sort that out.
As already said, this needs more test cases.
Thanks for your help - I have added more tests as requested.
More tests and cases would be helpful.
Thanks for your comment - I have now added more tests.
A single test case is not enough to make a very good kata, even for short ones. This would pass the tests:
You need multiple cases building up different tests (I recommend including empty arrays, as well as one and two word examples), as well as some random data to help prevent easy cheating.
Also, you state
Test cases contain valid input only
, but nowhere explain what valid input is. :-)Thanks for your help - appreciated.
I have taken steps to fix the points raised and you're quite right, one test is clearly insufficient.
Thanks, looks good!