57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 16 hours ago
Member for 11 years, 6 months, 6 days
Difficulty Advanced
We shall not cease from exploration, and the end of all our exploring will be to arrive where we started and know the place for the first time.
I put those chars @StefanPochmann generously provided me to good use - traded them for spaces at a favorable exchange rate. :-D
[Of course, now someone will make a 'vfn' solution without spaces. But that's just too predictable.:]
More
Lambdaizing an expression just for a call buys you nothing. `key=abs`.
And the first lambda can be replaced by a partial, which is usually a win.
More
Trivial generator expression doesn't buy you anything. `sum(array[::2])` is enough.
Also, `a * b` or `a*b`, but not `a *b`. Reminds me of `int *p` too much. :-D
More
This can be taken [much further](https://py.checkio.org/mission/adfgvx-cipher/publications/veky/python-3/talking-bout-my-generation/?ordering=most_voted&filtering=all). :-)
More
Like https://py.checkio.org/mission/adfgvx-cipher/publications/Sim0000/python-3/second/?ordering=most_voted&filtering=all, but better. ;-D
More
BASE.find(str_number[i]) really could be factored out.
Instead of that ugly index manipulations, you can use enumerate (and possibly reversed).
More
You mean, besides [PEP(hundreds=4, tens=6, ones=8)](https://www.python.org/dev/peps/pep-0468/)? ;-)
More
Standard string concatenation approach. For longer messages, you should be
aware of the "Schlemiel the painter" danger (you construct new strings
again and again, longer each time), but for short messages (in this task,
len is at most 1000) it's ok.
More
Essentially the same as mine. round without second argument rounds to int, so you don't need ,0 (if you're writing Py3K). Also, special casing "if data" is not needed. randint is a leftover from more adventurous phase, I guess. :-) Nice usage of hypot.
More
This recursion is really misplaced here. Python is not particularly recursive language, depth is cut off after 100 iterations. And [:-1] makes a copy of (almost) a whole list every time.
More
Nice solution (as always:). A few details:
* For distance, see complex and abs. Or at least math.hypot.
* For reachable, you don't have to invert each and every one of them... "all(not blah)" is "not any(blah)". It even seems more readable. :-)
* For intersect_cell, you don't need all four
More
http://www.checkio.org/mission/restricted-sum/publications/veky/python-3/obvious/
Thief. :-P
:-D
More
Even better. :-) Though, you don't have to listify all your generators, iterators are often completely ok to work with (if you have one pass). Also, functions can be nested. If can_match was local to checkio (loop), it could access guess and score from outer scope, receive only word as parameter, an
More
Either go fully with PEP8 (and put _two_ blank lines separating `min_max` from the rest of the code), or delete empty line 6 (much better in this case, I'd say). This way, line 7 is sticking like a sore thumb. :-o
For line 4, you can use EAFP style. Not really important, but might be nice to learn
More
What do you think lines 9, 18 and 19 are for? I think you misunderstood what "precondition" means.
More
Nice idea, but really too complicated implementation. See:
checkio=lambda t:3*"True"in"".join(str(w.isalpha())for w in t.split())
More
That .n and inserted str()s are really not necessary. This is one of places where inheriting from a builtin makes perfect sense.
class Addend(str): ...
More