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.
First rule of Regular Expressions - if have more simple use string method, then use more simple method than regular expressions =^)
Python new test framework should be used (Refer this for more detail)
And now I know about the sorted() function...I love it.
I doubted you so i make a script to test that. and in fact using the for is like more than 2x faster. as you can see in:
https://github.com/n4ndoDev/mystuff/blob/main/tm.py
Even though it's asking to rewrite the code, this is easier to understand, uses fewer lines of code and is simpler. In my opinion, this is a perfect solution since it teaches you what is most efficient instead of just doing what the problem asks.
this is Python style, if you want it easier, use Basic
the task was not to rewrite the function but to fix it
This shouldn't be marked as best practice. The second solution is simpler and much easier to read.
It's slowly then 'for' iteration!
yes, this kata only asked to fix the bug in the code. not rewrite the entire code.
No need to use a hard to understand function for something so easy
this is literally not the purpose of this ex I guess
This comment is hidden because it contains spoiler information about the solution
Can someone please explain me why we don't have to write that x an y are in arr? And how do python understand, who is x and who is y?
That's the point, that extra adjustment is not required. Below would work just fine:
return sum(int(d) ** (i) for i, d in enumerate(str(a),1)) == a
Loading more items...