57
veky
22 48 64 Leader of the month
44676/ 53887
Last seen 13 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
First-vadim.latypov
res: don't do this. It's much slower with no reason. Use for-else. for x, y, r in previous: if round(math.hypot(i-x, j-y)) != r: break else: return [i, j] (Or even better, use all with generator.) More
First-vanzaj
Cool, but can be done [better](http://www.checkio.org/mission/i-love-python/publications/veky/python-3/magnum-opus/). ;-) (In my defence, I _didn't_ misunderstand the task.;) A minor detail: it was probably easier to use .title, and then convert just L to l with (e.g.) .replace. More
Explicit Selfies-terryyin 1
Namespaces are one honking great idea -- let's do more of those! More
Heuristic and backtracking-ale1ster 1
Lines 4 and 5 are really ugly. See dict.setdefault. More
try-acman
Please, state what you want to catch. Don't ever write empty except - unless you really want to catch everything, which you almost never do. Look: imagine you accidentally reverse order of arguments and call index_power(2, (1, 2, 3, 4)). You'd like TypeError, right? But you get -1. :-/ More
advised by veky-shota243
In fact I meant something more [like this](http://www.checkio.org/mission/boolean-algebra/publications/veky/python-3/whats-up-__doc__/). More
First-chhyx2008 1
Don't single-exit your functions without good reason. Instead of "number = blah", just return blah. More
First-chhyx2008 1
elif in line 9 could just be "else", given the task. It seems to me you wrote line 3 (instead of just "for word in words.split():") because you thought you were optimizing something. You weren't. :-P This isn't C, and words is split only once, no matter how you write it. More
First-chhyx2008 1
Line 11 is doubly pointless. :-D One, either line 6 or line 8 will execute, so program will never get to line 11. And two, None is exactly the default return value. So even if index_power without line 11 somehow mysteriously fell through the bottom, return value would be None. More
First-chhyx2008 1
First, you can chain comparisons: 65 <= ord(char) <= 90 (or ord(char) in range(65, 91)). Second, you can compare strs: 'A' <= char <= 'Z'. And third, you can just write char.isupper(), which is what you really wanted to do anyway. :-D Unrelated: don't += strs in a loop. Much better is to append t More
First-jehutyy
"while greater than zero, subtract", is usually simpler expressed as divmod. ;-) More
First-silentAp
Again, inconsistent and really too long names. Your create_dictionaries could really use the help of enumerate builtin. ;-) extract_digits seems so complicated, I think map(int, str(number).zfill(3)) is much clearer about what's going on. You don't even need map(int... if you're willing to treat t More
First-silentAp
That's a really strange flow control. Wasn't it easier (e.g.) if char.isupper(): upper = True break More
Simple-silentAp
Why are lines after 16 in the loop?? Also, they can be combined with "or". Also, you don't need () after if. And range(0, 3) is simply range(3). More
Lambda hell-geruz 1
It's weird to call these functions "print_...". First one of them is just str. Instead of lines 1 and 9~23, wasn't it easier to just initialize fns directly? fns = fizz_buzz, str, str, fizz, str, buzz, ... or if you really want to show remainders in your code, use a dict fns = {0:fizz_ More
reversed-geruz
Is there any reason why first slice isn't just array[::2]? More
CharMask-geruz
Nice. To be more explicit, you can write 'c'*3 in ... To be more implicit :-), you can write '_c'[w.isalpha()] instead of if...else expression. More
First-geruz
Aaargh. Don't use while for iterating over a sequence. Please see enumerate builtin. And genexp (inside sum) can have nested fors. If that's your thing. :-) More
Lambda-geruz
Many of these have names already. For example, int.\_\_and\_\_, int.\_\_or\_\_, and int.\_\_xor\_\_. Also, you don't need any parentheses: ^ is associative, and has greater priority than |. More
Array generator-geruz
Please write sum(... for ...) instead of sum([... for ...]). If you want to know why, ask. Is there any particular reason why (lambda w: w in text.lower())(w) isn't just "w in text.lower()"? Beta reduction, man. :-D More