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.
Because this solution is at least 5 years old and it wasn't revalidated.
xrange() was removed in Python 3, how this code passed the test?
Same here. 👍
Made the same "mistake" :)
This is me being pedantic, but xrange is removed in Python 3, not deprecated.
This comment is hidden because it contains spoiler information about the solution
Don't know why I didn't use len()-1 to handle remainders. Added in a completely useless else clause to the return for mod of 1.
Is there any benefit to explicitly casting via int() vs just using floor division?
I know this is old, but given the fact that so many of us are new-ish to coding on the site, it makes sense that mob mentality kicks in after a while. After all, if so many people marked it best practice, it MUST be the best, right? Thankfully, we have a lot of more seasoned community members willing to tell us when and why we're wrong.
This is why I like these discussion boards. As a new person, I can read these and find new functions and methods that I wouldn't have known to research until now (to be clear, I do look through the documentation to learn more about different functions I think might be of use). I'm not going to lie. I did the O(n* n) method similar to shown above. Did I know it would be inefficient? Yes. Would it have been any more inefficient than anything else I thought up at the same time? No. Now, I know better, and my list of things to check in the documentation and Stack Overflow examples in the future got one item longer.
A readability metric might not be a good idea unless voting was restricted to more established members of the community. After all, a lot of newbies (myself included until recently) would mark a bunch of nested loops as more readable than things like list comps and sets simply because they didn't know what the notation represented. They'd just assume it's ugly, incomprehensible shorthand.
True, but that was an explicit constraint of the problem spec, so it's fair game.
TIL xrange exists. That one's definitely getting some use.
Edit: Or not. Apparently, it's been deprecated in Python 3. Thankfully, range() works for this as well.
Yep. Negative indexes count from the end of the variable. You can also do negative steps as well. General form is string[startstep].
Nah, no need to mark that, unless it gives clear clues how to solve a kata, or solution code itself. (For 7-8 kyu that's not a big problem anyway)
If it keeps happening, try hard refresh, logging out and in, different browser... If it doesn't go away, try posting an issue on codewars GitHub page (there should be this exact issue somewhere...)
Loading more items...