OP solved it, closing
I came to this sollution only after having performance issues with 2 perfectly valid ones. This an 8-kyu kata, not a math contest.
solution invalidated, closing
Interesting, just like mine..but the difference is that you used 'tuple'.
errrr.... it's actually a good question... x)
3 years later, I'd actually say it's perfectly fine in this situation (I guess I had in mind something about saturation of the memory with the extra list, but in most situations you won't see any problem. Now, if n is huge, you'll run into troubles anyway, but not necessarily because of the approach itself, but rather because of the size of the string you have to build...)
ccl: forget that message.
Could you elaborate on which specific aspect of the above code is dangerous or footgun-y?
I dont know about that.................you are awesome!!
The task is regex ... I find it strange to see other solutions. Of course they are possible and maybe easier ... but the kata is about learning regex ...
Thanks for your report. It is not the issue of this kata but CW API. To avoid confusion,I have added the link to the page explicitly.
This comment is hidden because it contains spoiler information about the solution
Thank you for addressing this issue. I am sure that no solution would be able to pass previous tests with Python 3.6 or Python 3.8. Try to fork the top solution and run it (it still has old tests with big ranges). If the top solution works for you, please report the completion time here.
I have verified that the original solution still passed all tests but lowered the range as it should be fine for 7kyu.
Python: the kata cannot be completed. I believe it is related to this issue. In general, Python tests should be updated and numbers in the range -9999 < n < 9999 should be tested as in other languages.
-9999 < n < 9999