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.
Python doesn't have arrays and the code above isn't creating a list either. It's creating a generator and the creation specifically takes almost no resource, since the values are generated lazily.
AFAIK the difference comes from the code above calling isdigit function a lot of times, whereas replace is only called 10 times. Keep in mind, that both of the functions are highly optimized and written in C, so that's why the the code with more function calls and more python is slower. That also for example causes some O(n^2) algorithms to run faster in python, than an O(n log n) alternative.
Not a good practice to use exceptions for implementing normal program flow.
Damn, your solution taught me something new. Didn't know you can turn a list into a dictionary with .fromkeys and it's clever that since keys have to be unique it essentially removes duplicates by default.
Nice!
Well done! Very useful functions on
string
emmm, make it matter, use for will more fast?
yeah I used .isnumeric lol
Bc creatin new array is more time and resource consuming. Using regex is BP for this case. My advise for everyone: learn what is regix (import re) and how to use it
ok, i didnt see anything 🏃🏃
god why i didn't think for sorting it first
The task is to maintain numbers' order in the argument array, not the Natural numbers order.
lol noobs
Nice! Wish I thought of that :D
wise
nice!
Loading more items...