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.
Unlike
search
anchoring the beginning of the exoression using an^
is not necessary when usingmatch
.match
is behaving likesearch
being anchored with\A
.You're only asked to return True if n is a digit, which is what the solution does. Nowhere in the kata description does it say you have to use regex.
I would argue in any case that it's better practice to use built-ins for this instead of bringing in the overhead of the regex library where it's not required.
submit your answer adding:
print("\n".join(map(str,n))
this shows which tests are passing or not
I tried with regex first and it failed one miserable test. I have no way to check which one, so I decided to take a shortcut. (=:
That's the beauty of it, as regex is not enforced ;-)
This doesn't employ RegExp at all. Although it passes the tests, it does not do what is asked.
This comment is hidden because it contains spoiler information about the solution
1: SPOILER FLAG! / 2: that's not ternary stuff, that's normal boolean expression.
This comment is hidden because it contains spoiler information about the solution