Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
In Python, at least, the built-in title method doesn't quite do the job here
I do apologize, I didn't see that note. What I meant by partial message is, if I receive a space before the first morse token, I have to decide why why that space is in the stream, because sppaces normally come after tokens. I can just assume the first token was delayed, causing the space, or I can more safely think there should have been a token before the space and my message will not be complete. Then I can signal the sender to retry or something like that.
Great kata though, I'm not at all complaining.
I am not sure what exactly you mean by "partial messages", but there is this note in the description:
This comment is hidden because it contains spoiler information about the solution
It does say that, quite clearly, but I took that to mean that 3 numbers is the "qualifying" metric for a range, i.e. once a canidate range has 3 numbers, you use it as a range. I think it might help to say something like:
A span of 3 or more consecutive numbers should be formatted as a range, i.e. the starting integer of the span separated from the end integer of the span by a dash.
Hey, but maybe it's just me, I was blazing through katas yesterday and probably jumped into coding too quickly at the expense of pondering the problem a bit longer. I think it's great kata, quite easy for 4kyu, and I will be wrapping it up now.
Doesn't it says at least 3 numbers there? Meaning three or more? IMHO you're saying the same, but I can be wrong and maybe one way of writing it is clearer than the other.
I must admit my critique was a bit exagerated, but this is the first kata out of a hundred odd that I've struggled this much to grasp. I see now, with Diego's help and diagram, although not really with his explanation, hehe, how this one is supposed to work.
It seems to me that this kata is explained from the point of view of a consumer of such a list, as then it is abundantly clear. Maybe other people might also benefit from it being more clear that 3 numbers is a minimum size of a range and it should ne more whenever possible.
That means
[1, 2, 4, 5, 6]
is"1,2,4-6"
and not"1-2,4-6"
.-10, -9 and -8 form this range:
"-10--8"
. I think you're confusing what should be consecutive as a number and as an element in the list.11 and 14 aren't consecutive numbers, so, obviously, the range ends in 11.
There is no mistery there, it says at least 3 numbers, there can be more.
I'd close this, because I think it all comes to your misunderstanding of the instructions, which are fine be me.
The goal is to group all numbers adjacent in the list which differ at most by 1. In your example of
[-9, -8, -6]
, two last numbers do not differ by 1. If you have an idea for a better wording, feel free to suggest one.The description for this kata is unclear. It says,
It is not considered a range unless it spans at least 3 numbers. For example "12,13,15-17"
, but then the example solution shows this:None of the consecutive elements at positions 0,1, and 2 differ by more than 1, yet the return value shows
-10--8
as a range. Yes, the slice[-1, -9, -8]
itself spans 3 numbers, but so do[-9, -8, -6]
and[-8, -6, -3]
etc. Maybe we're supposed to start at "peg" 0 and whenindex - 0 >= 3
we have the range-10--8
. In that case, it only makes sense to resume with index 3, or-6
. but then I would expect the next range to be-6--2
, or-6--1
, depending if the author uses high or low values for of 3.-3-1
, with-6
being left all on its ownsome. This one now spans 5 numbers, where my delusion was that ranges spanned 3 numbers.3-5
starts where I expect it to, directly after the previous range, and it spans 3 numbers, as claimed.7-11
starts out well, 1 position after3-5
, but then it swallows a whole 5 numbers, and abandons15
.17-20
fortunately heralds the end of this hamster wheel of reasoning, but not before mysteriously consuming four numbers.Hello, newbie in codewars, interested in the question of how to pass to a variable, the values of tests already breaking my head can not think of.
This is not unique to Jaden, but is well known in software as TitleCase, unless I'm missing something.