57
veky
22 48 64 Leader of the month
44676/ 53887
Last seen 21 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
All combinations-LukeSolo 1
Wow, look, LukeSolo wrote a for loop! Of course, you wouldn't be you if you didn't squeeze a generator inside. :-P for a in (b for c in d): smth is more clearly expressed as: for c in d: a = b smth One additional assignment is worth it. :-) Also, for upper limit More
verbose, many Comments-reviewboy
Lines 13~15 are _horrible_. Really. I still don't think you really understand what's going on there and why it "works". (What is hasUC for "aBcDe"?) And now for minor details: bool is unnecessary, task says anything boolable will be accepted. What does data.isalnum() do here? It's a precondition, More
First-reviewboy
Again, use key argument instead of decorating and undecorating. Using _min_ to solve _most_ wanted letter is really confusing. And drop the []. max(string.ascii_lowercase, key=text.lower.count) Nicer, right? :-) More
First-reviewboy
You see how complicated code becomes when you artificially try to single-exit your functions? This is not Pascal. Just return it when you get it. for combo in b: if combo == "XXX": return "X" if combo == "OOO": return "O" return "D" Even better, why More
First-reviewboy
Don't give irrelevant names to things used only once. w = word.lower() doesn't accomplish anything. And a.find(b) != -1 is a _really_ strange way of writing "b in a". Also, you can use sum for counting. But that's wizardry. :-) More
Simple List-wccrawford
Use unpacking in for: for dx, dy in neighbors: Also, use chaining: 0 <= x < len(...) "if blah and something == 1: count += 1" can be "if blah: count += something", right? something can be only 1 and 0 here. More
lru_cache-gyahun_dash 1
Nice. When someone asks me what my solution does, I'll just refer them to you. :-D More
Base64-ciel
Cool! Why this isn't in Creative category? :-) BTW dna really should be a bytes (b'...'). Then you wouldn't need all these encode/decode shenanigans. ;-) More
one line-michael.kej
set([f for f in blah]) is just set(blah). :-) More
First-michael.kej
Cool. You could have used *args, but this is ok too. More
First-michael.kej
Builtin sum might come handy. And array[len(array)-1] is just array[-1]. More
First-michael.kej
Aaaargh. Too complicated for my poor eyes. :-/ "== True", why? And Lines 10~11, why not just [i]? And why not use a real dict, with setdefault instead of that checking all the time? Or better yet, just use a collections.Counter. Or even better, use builtin max with custom key. ;-P Detail: at the e More
First-UndeadMonkey 1
letter.isupper() is what you're looking for. ;-) Also, don't use Schlemiel the Painter's algorithm without understanding. :-] More
First-Mycroft0121 1
Yes, you should have used a dict. (Rule of thumb: if it would be an ordinary switch (with breaks after every case) in C, it is not if/elsif/elsif/else in Python. It is (probably) a dict. If it is too complicated for a dict (code differs, not only data), then it is a class. But it's almost never a bu More
FIFO stack-NikhilVashisth 1
"if len(stack)!=0" is just "if stack". More
max(0,col-1)-EcNeu 1
Title can be written as col-bool(col). ;-) Lines 8~10: second = sum(...) - grid[row][col] BTW, pattern as in your lines 3~6 and 12~15 can be written as first = row != 0 and sum(...) third = row != len(grid) - 1 and sum(...) More
First-bunnychai
Nice hack with %180. :-D Bare excepts are usually frowned upon, but this is obivously a quick&dirty solution. More
Second-Taca
That numpy cannot be used doesn't mean you should go medieval on ranges of lens. :-/ map(sum, matrix) map(sum, zip(*matrix)) Also, lines 22 and 23: nice usage of enumerate, decorate-max-undecorate, key and itemgetter, but you could have just sums.index(min(sums)) BTW [see second para More
First-Taca 1
This becomes ridiculous. You solve everything with re? :-D b = "".join(x for x in expression if x in "()[]{}") Also, not everything is a list. ;-) And you should decide _what_ name you want, instead of giving three names to the same object. :-D Lines 13~16: just return not b. More
First-Taca 1
Line 3: mapList doesn't have to be a list. "abcdefgh" will do just fine. Lines 5~7: just write "for k, l in pawns:". Don't range(len(. Ever. :-) Also, not everything is a list. If you removed line 2 and made difence (defense?) a set (just put {} instead of [] around comprehension), you could just More