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.
This one should be BP.
Remember, you can use \d instead 0-9 and there is fullmatch() function, in this case fullmatch makes code more readeable, bc we have less regex code (which is not for reading, write-only code)
Bc If zero or more characters at the beginning of string match the regular expression pattern, return a corresponding match object. Return None if the string does not match the pattern; note that this is different from a zero-length match. So, u get a RE object or None, but we need a bool type as an answer.
You can read more here: https://docs.python.org/3/library/re.html
bool
can be dropped?What???
This comment is hidden because it contains spoiler information about the solution
This is what I thought: if matched a invalid char then it means u have to return false.
This comment is hidden because it contains spoiler information about the solution
amazing..
Doesn't work for n = 0 or 1
The number of triple nested loops is amazing. Some beautifully clean code as this example above. But yikes, a bad habit to avoid at all costs unless you have no other option.
This comment is hidden because it contains spoiler information about the solution
The adoption of package 'decimal' is great.
You shoudn't use lambdas inside
map/filter/reduce
: a list comprehension is always recommended when you don't already have a function.If you really want to use
map
, then usedict.get
This comment is hidden because it contains spoiler information about the solution
wow, what the hell...nice code man!
Loading more items...