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.
we got the same solution
Same, I forgot it too.
Exactly. I'm just seeing that for the first time.
Actually on this site i seeing many people who kinda like to explain their code. Thats why i asked this question, and ofc playing with code and trying to figure out how it work before write comment.
Don't expect someone else to give you the answer. You can make trials with this code to see what it's doing.
Note this code was written on Python 2, you must use
//
to perform an integer division in Python 3.Why exactly if
len(s)
is odd then negative index slicings[-mid]
return substring witouht first number?I guess this operation with negative-index slicing making algorithm much more elegant and clearful, and allow you to rid of multiple
if .. else
blocks. But i still cant find out how it works.This comment is hidden because it contains spoiler information about the solution
groupby()
take iterable(sort of sequence) and return tuple of group key(str) and lazy iterator(itertols._grouper).So because its lazy it will give you a value only as in needed. But you can get sum of iterators values.
Then you need to create generator expression, which consist of
Hope i did it good.
I was little confusing about this case too :)
Although, this is good practice for data validation
IMHO 6 kyu kata. Pretty intresting, as for me
you didn't read the description...
I dont get it: How is it possible to palindromize 750? reversed is 057.
I think this solution not so optimal at the point of memory managment. Using copy for new str is resourcefull operation that allocate new memory for new obj.
Better one is consistant comparison, when we compare letter from end and from start of input string.
.lower()
method for valid compare. Only counting indenfier increase and decrease. So, if we have different letters - loop is over.You're right and wrong at the same time. Codewars not only about algorithm training, its about finding more efficient solution too.
Anyway, its cool, when u able to implement logic/algorithm of built-in function, and this able itself give you understanding of inner logic of those functions
This comment is hidden because it contains spoiler information about the solution
Loading more items...