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.
This comment is hidden because it contains spoiler information about the solution
No, the kata test cases all provide a list with exactly one duplicated element, so both
start
andend
will have actual numerical values; to be specific - index of the first occurence of the duplicated element and the index of the second occurence of the same element. These are then used to return the expected slice of the input list.ok so you mean that the start variable automatically takes the value of the first variable which is related to the end counter?
So if no variables allow the counter to reach greater than 1 then the value of start would have been None, right?
in case of that kata, the right side of the first assignment will always return a list with two values (the input list will only have one duplicated element, so the condition
arr.count(x) > 1
will be met only for two identical elements), thus the assignmentstart, end = [...]
will assign a first value tostart
and second toend
. The values are indices of this elements, beacuse as you can see I am using theenumerate
function (for more info check the Python docs onenumerate
) on the input array.They are just declaring a variable they will use to store the index of the first repeated element
can someone tell me what does the start refer to ?
read the comments
I don't understand how it can be used to pass the test ?