57
veky
22 48 64 Leader of the month
44583/ 53887
Last seen 14 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.

Best reviews / Newest reviews
First-LukeSolo 1 1
Line 7 can be written: if num in cur_alpha. Or better yet, use EAFP instead of twice going through. Just remove lines 6~8, change .find to .index in line 10, catch ValueError and return -1 in that case. More
One line to check them all-LukeSolo 1 1
You don't need second half of or. ;-) More
Clear enough-LukeSolo 1 1
You can use sum builtin instead of manual management of count, and you can use enumerate instead of manual index management. ;-) More
First-xiaozhan 1 1
Nice. BTW squeezed-space operators like ** and even > can be ok, but after the colon there should really be a space. (Unless you're golfing, but in that case you can save a lot more chars - even spaces.:) More
First-xiaozhan 1 1
First, don't map lambda, use genexps: tuple(map(lambda x: number%x == 0, [3,5])) ~~~> tuple(not number%x for x in [3,5]) (Also, as you see, not is smart and can be used here for greater readability: 'there is no remainder'.) Second, in last line, that pattern is clearer coded using dict.get: More
Shortish-LewisFogden 1
Either make verify_anagrams a lambda, or make s a def. It's slightly inconsistent this way. :-) More
House Password: using "re"-LewisFogden 1 1
See all builtin. It will help you. ;-) all(re.search(p, data) for p in "[A-Z] [a-z] [0-9]".split()) and len(data) > 9 More
It can take negative indexes too-borisuvarov 1 1
... except if array is empty, then it cannot. ;-D More
Bad Algorithm-MackM 1
Only few things... Names starting with uppercase are usually not used locally. In line 4, look at the set.intersection_update, or shorthanded &=. Or you can eliminate the loop with return max(set.intersection(*map(Factor, args)) It's practically direct translation: max ~~ More
Simple-gflegar 1 1
Python relations can be chained (as in math). check can be written as g[r][c] == g[r + dr][c + dc] == g[r + 2*dr][c + 2*dc] != '.' BTW, Guido usually recommends that when you have mixed priority operators, operators binding tighter shouldn't be space-separated from their arguments (see abo More
First-gflegar 1
This is a nice place to teach you about *-calls. First, i+j\*1j is complex(i,j). That is not so exciting. But if a=(b,c), complex(b,c) can be written as complex(\*a). In your case, since len(a)==3, complex(\*a[:2]) would do the job. Functions can take their (last) arguments from any sequence, for More
First-gflegar 1
An obvious solution. Just a few hints: frozenset([int(s[0]),int(s[1])]) is frozenset(map(int,s)). frozenset([n,i]) (better written as frozenset({n,i})) really ought to be assigned to a variable, it's used in lines 8, 9 and 13. BTW instead of closing over ts and manually screwing it into pla More
First-tivvit 1 1
Obvious. :-) Now count zeros. ;-) More
First-santosh.pagare 1 1
Lines 4,5,6: digits = lowers = uppers = 0 Line 1: unnecessary. :-) Lines 8~13: digits += c.isdigit() lowers += c.islower() uppers += c.isupper() or if you insist on using unbound method, remove initialization and just say digits = sum(map(str.isdigit, data)) Lines 15~18: More
recurrence-bunnychai 1
Argh, float("%.2f" % x)... you really should use the function "round". ;-) More
vefan-veky 1 1
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
Second, controlled oversampling (more effective)-Tinus_Trotyl 1
Wasn't it easier to do that `set(connection.split("-"))` thing only once? :-) Also, `break else return` is a powerful pattern that's better than bool flags. See [my solution](https://py.checkio.org/mission/find-friends/publications/veky/python-3/tinus-trotyls-pythonified/) for implementation. :-) More
Spelled out-TomTerebus 1
More importantly, every if cond: return 1 else: return 0 is simply "return int(cond)". Switch is not if/elif/elif... here, but simply a dict. But this is not so important as what I said above. More
8 times a 45° sector-Tinus_Trotyl 1 1
Now do it with complex numbers. :-D More
First-Archagiel 1
You are using Python3, use it properly. You know about // (line 9), use it in line 5 too. i1 = a // 2 i2 = i1 - 1 (int - 1 is always int:) More