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.
I have the same problem, could you solve it or is it an error of the test case?
@farhanaditya, doesn't Python match already checks from the beginning of the string? Then why would it match forbidden characters?
The ? after the * is to use lazy instead of greedy quantification, it just makes the process slightly faster (since it returns after the first match) but either one should work.
Not only you lol
This comment is hidden because it contains spoiler information about the solution
Yes, it's necessary. Otherwise you'd match forbidden characters at the start of the string.
This comment is hidden because it contains spoiler information about the solution
Mad World!
Compliments are always welcome. Thanks!
Try them all here: https://www.codewars.com/collections/dinglemouse
DM
(and moreover, it's
O(n)
;) )It's a "pythonic habit".
Now, about good practice or not... Ask to a python guy, he'll answer yes. Ask to a Java one, you'll surely get the opposite... Personnal opinion: the language has been specifically designed for it so... I go for it.
Glad I could help :)
I personnaly tend to disagree on that ("cleaner") for python, at least when nested map/filter/reduce stuff enter the place, because you have to write the code in reversed order compared to the logical reasonning. That's one point where python is very bad... JS or ruby are much clearer, for that. Same happens for nested comprehensions.
note: spoiler flag ;)
This comment is hidden because it contains spoiler information about the solution
it just depends on my mood... ;o (here it makes the code a bit shorter)