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.
It's a method to ignore specific values.
For instance:
a,_,b = (1,2,3)
Then: a=1 and b=3
Another example:
a,*_, b = (1,2,3,4,5,6,7,8)
a = 1 and b = 8
Other function to this is save the last result in "_" variable.
So if you do this:
2+4 -> result= 6
_ -> result= 6 #save the last result in your program.
For separate numbers:
But you can do:
This link helps so much: https://www.datacamp.com/tutorial/role-underscore-python
If you slice sequences by specifying out of bound index, it will slice the sequence to nearest index
I think its because the question asks for groups of CONSECUTIVE size difference? With a class of one, the only consecutive solution would be [1,0]. While that may be correct in a purely mathematical way, that would not really be dividing the class in any actual groups (which was what was asked for).
I think I was playing around with diffetent solutions and accidently forget to remove the import.
I do not quite understand: at which point are you using that "product" import from itertools?
totaly valid solution. Feels a bit like cheating though... X)
Damn, i had the same issue. thanls for clarifying
One test case seems incorrect, given the wording of the instructions:
the test case t = 163, k = 3, ls = [50] is expected to return "None". But according to the instructions it should be "50"
since the guy wants to travel LESS than t miles and visit LESS than k cities and the woman is happy to visit as many cities as possible on her list ( which is one in this case) the correct solution would be to travel to her one and only destination (which is 50 miles away: less than t miles and less than k cities. all that the guy wanted)
or am i wrong? (nice kata anyway, though)
Added a note.
.
Not really a big problem, but the Kata does not actually specify that shift will not be larger than the length of the alphabet. Most of the accepted solutions would not work if shift was set larger than 26.
Perhaps either more test cases with larger shift values should be given, or a shift-size <= 26 should be specified in tha kata description?
Nice, but I noticed the kata did not actually specify that shift would never be larger than the Alphabet size. Although not present in the test.cases, this solution will not work if shift > 26.
It seems that in the Python of this, the same object is passed as a variable to the function, and is also used to test the result. I haven't encountered this in other exercises before.
I just resolved this issue in my own solution, but it seems several people are frustrated by this problem. This seems to be causing unnecessary hassle for people - maybe it's worth changing?
I agree, this issue is not resolved - I am having the same issue.
Input array:
[7, 0, 'z', 'c', 0, 7, 0, 'z', 'c', 0, 8, 0, 'y', -6, 'b', 0, 0, False, 2, 9, 8, -4, 0, 0, -2, False, -7, -9, -2, 0, -6, 'pippi', 0, 'z']
My function's output:
[7, 'z', 'c', 7, 'z', 'c', 8, 'y', -6, 'b', False, 2, 9, 8, -4, -2, False, -7, -9, -2, -6, 'pippi', 'z', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
The test's expected output:
[7, 'z', 'c', 7, 'z', 'c', 8, 'y', -6, 'b', False, 2, 9, 8, -4, -2, False, -7, -9, -2, -6, 'pippi', 'z']
There are no zeros in the expected output - this appears to be a mistake.
This comment is hidden because it contains spoiler information about the solution
Loading more items...