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.
As others have pointed out, it needs more random tests.
True!
This looks very inefficient.
Kudos for just typing a space instead of
\s
Oh wow iterating through each letter is actually not that hard.
Try to google "multiple assignment".
Or read https://stackabuse.com/unpacking-in-python-beyond-parallel-assignment/ for a more in depth explanation.
Also for
(-1, 1)[n<1]
,n<1
will be evaluated as a boolean, True is equivalent to 1 and False to 0, so it could be translated asWhat on earth is this syntax? I'm new to Python. I just learned about list comprehensions, and now this:
sign, n = (1, -1)[n < 0], abs(n)
. I have not the slightest idea what it does. Could you maybe please point me in the right direction?.
.
Fixed.
Needs lots of other decimals with varying number of significant digits.
And 1 random test cases is far from enough. Not to mention that you pass
-2
as the second parameter, basically nullifying whatever random tests are supposed to do.Except you have string inputs. Strings are not numbers.
Also,
roundAndPad(-1.1232,19) == "-1.1232000000000000000"
does not make much sense because double precision floats doesn't have 19 digits of precision anyway, so if you're rounding it to 19 decimal places you'll get stuff like-1.1231999999999999762
.The only way to do this properly is to write a function that checks for all the TLDs that have two parts (co.uk, co.sg, co.il, etc.).
Technically the first part of the hostname does not have to be www. For example, it can be mail.zombie-thing.co.uk.
Since it would be tedious to collect all the TLDs that have two parts, I'll just assume that the subdomain can only be www.
The question should make the expectations clearer. Others have pointed it out, it is not very well formulated.
Taking types into consideration, this is not true. The test suite still expects a string when
d
is negative, rather than the numbern
itself.Since you ask to handle "a sequence of any type", it is definitely not trivial in JavaScript.
I would rank it 6th Kyu because you have to know about advanced language features.
Loading more items...