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 could write comments on a fork if you want.
I don't bother since it's not something I'll reuse and people here are those who solved it, so most will be able to understand. :)
idk, looks much less obscure to me than any 10+ lines solutions. Of course comments would be welcome, but even w/o comments this one takes much less time to read and fully understand.
HINT: You should probably try to make your function work the same, regardless of the spacing
of course "poor readability", bu this is still pythonic :D
If you look here: https://github.com/codewars/codewars.com/wiki/Language-Python (google: codewars python environment)
they link to https://github.com/Codewars/codewars.com/wiki/Codewars-Python-Test-Framework-V2
which in turn is https://github.com/Codewars/python-test-framework
which you can install with
pip install --user git+https://github.com/Codewars/python-test-framework
and then
(obviously it's odd to import it as two names, but both are used in the example test code for this kata and
print(test is Test)
says they're the same thingand as always when installing something - consider who it comes from, how much you trust them, what you trust them with, and so on.
you could also edit the test cases to use
assert
and run it with pytest, or edit it to fit whatever test framework... probably the same amount of work and works just as wellI do really recommend working with a proper IDE, especially when you are going to invest "hours of work" in solving of "complex problems".
Honestly, I cannot even imagine working on a challenging kata without proper syntax highlighting, syntax checking, helpful editor features, and step by step debugging. It's really worth it.
Hi,
ctrl+H
ctrl+S
: run example testsctrl+enter
: attemptTo clarify: this specific approach here is not a cheat. Lookup tables and precalculation are perfectly valid techniques in coding. Anyway, the author had to write the actual code to find the numbers, right?
Yes.