Retired
String chunks (retired)
457 of 1,020keune
Loading description...
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.
Callers error:
Read the description carefully.
updated python test framework
Approved
This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/202.
Please join the discussion to help us identify duplicate kata and retire them.
Retired as a duplicate.
This comment has been hidden.
#11b2T/3pz:0z:vV <\br> this really demonstrates the power of the list comprehension
Oh come on, if your program gets "3angle" as an integer input, you should let it die, not pass the error silently to the next unsuspecting function.
This comment has been hidden.
So why are there tests with
n
being a string?Ikr
Ruby translation, please check and approve :-)
Kata retired.
This comment has been hidden.
Passed all the tests, recieved:
FATAL ERROR: JS Allocation failed - process out of memory 5 Passed 0 Failed 0 Errors Process took 2268ms to complete
Is it a problem on your side or I`m doing something wrong?
If you can pots your code and mark it as a spoiler we can tell you exactly what's wrong. :)
This comment has been hidden.
you need to finish your for loop and make sure n > 0 and n is a number
Now it works, thanks a lot :)
please mark this issue as resolved :)
Hi iam stuck on test case ['bizarre love'] should equal [], on invalid chuck size 7 passed 1 failed. I run the following assertion: test.assert_equals(string_chunk('bizarre love',), []); and pass it. Iam not sure if this is what the test case wants me to do, but with that description i dont see the mistake or whats the result it should be. Any ideas?. THX
Protip: By "printing" (literally using 'print' function), you may determine what arguments were passed by testing functions. Those will appear in "output" frame. If you will print out passed arguments, I am gladly sure you will solve the problem :)
You need to be sure that n is a number
A comment should not be marked as an Issue unless it is confirmed that the problem being described is due to the Kata itself.
The test cases don't check the case [n > length of the string], but the instructions demand to handle that case:
"If n is greater than the lenght of the string, you should return an array with the only element being the same string."
So currently that part could be left out and you still get to submit your final solution.
Please specify the language in which this particular edge case assertion is missing. AFAIK this edge case is tested at least once in JavaScript.
The language in which I experienced the behaviour one year ago was JavaScript, maybe it was fixed in the meantime.
Receiving the following Failed pass after 6 valid passes:
Expected: [], instead got: [""]
Trying to recreate the same input that would give me [""] in my test runs, but so far nothing. Any ideas?
This comment has been hidden.
Can anyone please advise me why it says my code passed all tests with 0 failed and 0 errors and still gives 'Incorrect' in the end with red colour? Any help will be greatly appreciated. Thanks.
This comment has been hidden.
I'm getting an error "Expected: ["hel","lo ","wor","ld"], instead got: ["hel","lo","wor","ld"]". Any help will be appreciated :)
"lo " not equal "lo" (space)
A comment should not be marked as an Issue unless it is confirmed that the problem being described is due to the Kata itself.
Typo in description: "If n is not a valid size(> 0) (or is absent)" should be <0 (less than 0) rather than greater than 0 as it's describing invalid conditions.
Also a small typo in the next line 'lenght' --> 'length'
I've written my code and it has passes when I hit test. However when I submit it It passes the tests again (including the invalid chunk size tests) then throws up this error:
"Traceback: in TypeError: string_chunk() takes exactly 2 arguments (1 given)"
Cannot figure out what is wrong on my end, is it an error with the test cases? Any help is greatly appreciated
Same here.
Had the same error so I defaulted the n argument to 0, there is a test case where it's left blank and the function should then return the string. I'm getting another error now, don't know if it's related or not.
//edit: The error was related to a further test I think, so not to the defaulting.
+1 for the same error in Python.
another here!
the same error
I want to give crap for those edge cases... but I understand that they are day to day stuff we have to deal with, so I wont. Only one thing tough, there is one case that has you modifying the function chunk argument. That should already be taken care of, for the simple reason that the function definition appears by default, and most people don't think of changing any of that, at the assumption that the author created it correctly.
So, either remove the complete function definition or eliminate the case when no chunk size is entered. It could be left if the feedback from the test cases were more accurate but in my case all I got was that process took way too much time to complete, it never told me anything about missing arguments.
kata is easy author said.good luck with random edge cases
Is this sarcasm?
yup. this kata was pretty challenging. one of the test cases was "this kata easy" and far from easy
I agree. I think that at least should be 6 or 5th Kyu. The tests cases put an pretty good emphasis on performance.
Edit: My bad, no performance issues here, just that the feedback from the test cases is all messed up in those invalid chunk size edge cases. It always says process took too long. I would suggest to pass those test cases upfront, and just leave the random ones hidden.
This comment has been hidden.
Python translation kumited.
approved.
I'm not sure if that's your intention but the length and chunkSize during random tests are not random. length is always 100 and chunksize always 20.
This comment has been hidden.
Your solution is not taking invalid values of
n
into account.Added a coffeescript translation!
approved!
The description is quite bad... Here are some suggestions:
n
length? The current explantion ('takes a string and a positive integer n, and returns an array of strings of n length') is quite vague.i've updated the description to be more clear.
This comment has been hidden.
If n is not a valid size (or is absent), you should return an empty array.
Ohk but at first I didn't thought it meant that, maybe you can make it clear...Anyway I marking this as ready :)
Hey keune with reference to your 3rd Example -
stringChunk('hello world', 3) // ['hel', 'lo ', 'wor', 'ld']
I think your 2nd Example should bestringChunk('this kata easy', 4) // ['this', ' kat', 'a ea', 'sy']
am I right??yep. you're right. fixed.
And I think you should also add an example where
n is greater than the lenght of the string
.