57
veky
22 48 64 Leader of the month
44676/ 53887
Last seen 23 hours ago
Member for 11 years, 6 months, 24 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.

Best reviews / Newest reviews
Recursion-ichaleynbin 3 2
Much more pythonic is: def checkio(data): try: return data[0] + checkio(data[1:]) except IndexError: return 0 EAFP. ;-) More
Dijkstra-PositronicLlama 3 2
Nice and straightforward. But Dijkstra is massive overkill. The point is, there are only two paths (+ degenerate case) you have to explore. See my solution, I can write it in long form if you need. More
First-makoto_yamagata 3 2
Cool, but could be better. [blah, blah] if cond else [] ~~~> [blah, blah] * cond And those three `n`s should really have three different names. `h`, `t` and `o`, if nothing else. :-) More
Union Find-bukebuer 3 1
Nice UF. But of course you don't need a class. Line 44: You don't need `list()`. In fact you don't need `set()` either. ;-] Line 45: `sorted(eggs, key=spam)[-1]` is also known as `max(eggs, key=spam)`. Timsort _is_ damn fast, but max is linear. :-) Line 19: see `dict.fromkeys`. Very useful and fe More
First-spoty 3 3
Bresenham is cool, but overkill. You just need to see if a line intersects any of the four edges. That can be done with classical "signed triangle areas" algorithm. (Of course, in my algorithm A* is overkill (Dijkstra is fine, as you show), but my A* is universal - I have used it unchanged on at More
First-Uladzimir 3 1
abs is a function, no need to lambdize it. :-) More
First-Tinus_Trotyl 3 1
.title does splitting, capitalizing and joining all at once. :-) More
Toad-veky 3 2
This should be fast enough for you performance fetishists. :-P Explanation of a title, since I've seen many people not get the point of my titles: Besides hopping as a toad from state to state, this is also ugly as one. :-P Also see the `)):` in line 33. Python is very sad. :-( More
First-michael.kej 3 1
.replace('0', '1') is really a hack. :-) If you want to be clear, if (or filter) would be better. Also, total is a strange name for a product. ;-) More
First-Sim0000 3 1
Nice. BTW, there are set literals in Python: set([first, second]) -> {first, second}. More
Math-bryukh 3 4
int(round(bla,0)) is just round(bla). Also, see "Always use a def statement instead of an assignment statement that binds a lambda expression directly to a name." (new version of PEP8). Otherwise, nice solution. More
WordsFinder-bunnychai 3 1
re is obviously an overkill here. With the necessary escaping it is even longer than ordinary index (or my approach:). And you don't even use IGNORECASE. Nice use of bisect.insort. :-) That ugly offset calculating can be completely removed, if only you replace "enumerate" with "reversed" in li More
First-qria 2 1
Nice, but can be compressed much further. First, you don't need twice as long items in ALPHABETS, just say text.upper() at end of line 4. Second, once you know that only \w are in your words (and BTW you don't need []s), you only need one item in ALPHABETS, another one can be deduced with [A-Z] a More
First-Fedorovich 2 1
This is a nice example of how chaining can help you write better code. First, x == 1 and y == 1 can be written as x == y == 1. Then you see you have it also in equivalence. if x == y == 1 or x == y == 0: Then you see you can factor out x == y. if x == y in (0, 1): Then you realize that More
oneliner-tivvit 2
Why [0]? There is no char in Python, just str of len 1. Just as there is no "digit", just a single-digit int. :-) And don't aggregate over listcomps. Drop the [] inside .join(). More
as simple as cooking popcorn-Tinus_Trotyl 2 1
Those two pops are endearing! :) More
not smart but from beginner-b-612 2 1
For a beginner, it's pretty smart. ;-) But... blah if cond else 0 ~~~> blah * cond That's exactly what multiplication with bool does. More importantly, `words = words.split()` has no advantages (over just `for word in words.split()`) and many disadvantages. First, by rebinding the name More
First-splinter12345 2
Don't separate : by a space on the left ("else :"). It might look cute, but almost nobody else does that. Try to be more consistent with those spaces all in all (line 6). == can be chained: number % 3 == number % 5 == 0 You don't need result: you can just return whatever you want when you want, yo More
Just let yourself be boring!-borisuvarov 2 2
If you don't want to be boring, you can always look at the @StefanPochmann's solution. ;-) More
First (ugly?)-g.david.krupicka 2 1
Nice handling of empty stack. :-) But the end is just return not stack More