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.
Nice job!
This is like what I did, but in one line.
Python noob here, I gotta say Python one-liners like list comprehension are starting to look pretty understandable (at this level of complexity, at least...)
But cramming logic that repeats on each 'x' doesn't look good for Big O, for sure.
But seriously, what scares me is the number of cheerful comments.
We are in deep trouble.
Python goes brrrrrrr codestyle <3
Nice
Yep, no need in str(value) and len(str(value)) every iteration. Unnecessary operations.
why is that?
Sadly in Python using string functions is sometimes more performant than calculating these values.
From my point of view (I'm someone who is just starting to learn Python), the most important thing when designing a function wouldn't be efficiency, the time it takes to execute, right? Whenever I manage to solve a function, I compare it with others using the timeit module, and if one runs faster than another, it's better. Many times, I find that some written in just one line are not the most efficient.
best practices
This comment is hidden because it contains spoiler information about the solution
Nice one liner!
You are absolutely right! However, in codewars I view 1-line solutions more like a mini-achievement of making a code in one line, rather than the practical solution and I think there can't be good argument against writing your code in a more coherent way, naming almost every variable in an understandable way so others didn't have the hard time reading your code
As I know, at first, possible errors, non-standard situations are written in the if block.
Loading more items...