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
First-gflegar 1
Too bad you didn't find a closed form solution. ;-) More
_-blaxmi 1
You like those complicated control flows very much, do you? :-D You're one of rare people here that can stuff if/if/else, nested if, not, or, continue and return from for loop in about 6 PEP8-approved lines. :-D More
First-blaxmi 1
Any particular reason why you use "if n != 0" instead of "if n"? BTW that "words" really could be a generator function. "yield whatever" is nicer than "words.append(whatever)". More
First-blueBlood 1 1
"i = s = 1" is probably nicer than separate assignments. number - s >= 0 is just "number >= s". Lines 8, 9, 10, 11 and 15 (:-o) can be written as one line: "return max(number, s - i)". More
First-blueBlood 1
When you already write that list comprehension in line 6, instead of 0 you can just write data[j][i]. And solution over. :-P BTW, "something == 0 or something >= 10" can be written more easily as not 0 < something < 10 More
First-blueBlood 1
See Counter in collections module. Lines 23 and 25 are just: return alphaf == alphas. Your code is really too parallel. You should consider writing a function and then applying it to first_word and second_word separately. More
First-coells 1 1
May I ask why importing two modules, when simple builtin sum would have sufficed? Yes, solution is surely cute. But IMO it would have been cuter with m=sum(matrix,[]). More
First-Reuborz 1
Why do you have a variable is_safe? Every time you set it, you just return it immediately. You can have "return False" instead of lines 9~10, and return upper_case_count and lower_case_count and digit_count instead of lines 21~24. More
First-Reuborz 1
That purple "max" variable is trying to tell you something. Don't write max from scratch, use max builtin. It has a key argument. Also, lines 4~7 are a bit repetitive. Learn about collections.Counter, it will make your life easier. ;-) More
reduce-gyahun_dash 1 1
This is an original reducer. :-) Since you use Fraction and reduce only once, it would probably be clearer to "import fractions, functools" at the top, and then address them with full names. About that "[1] +"... you might want to know that functools.reduce accepts optional third parameter for More
First-Sim0000 1 1
Two pairs of parentheses are not needed. ;-) More
First-martin.beseda.3 1 1
Wouldn't it be nicer if lambdas were declared with real number of parameters, and called with *args? If you insist on indexing, "lambda x:" really should be factored out. More
First-martin.beseda.3 1 1
Line 1 expression can just be "secs // 60 + (secs % 60 > 0)". bool _is_ int. ;-) That antipattern in lines 10~13 really should have been using collections.Counter. Learn about it, you'll love it. ;-) Lines 16~19 are _precisely_ the reason why Guido finally added conditional expressions to Pyth More
First-martin.beseda.3 1
When a loop has 4 lines, one of which is "continue", that's surely an overkill. :-) "if word != w and word.endswith(w):" is obvious solution. "for w in dic - {word}:" is a clever one. ;-) More
First-martin.beseda.3 1 1
Wow. Until now, I thought you came from Perl land, but now I'm not so sure. Very few of these people know about accumulator recursions. :-) More
Second-mr.floppy 1
NEVER write empty except. It catches much more than you think. Here it doesn't really matter much, but don't pick that habit. Always state what you intend to catch. More
First-fishiwhj 1 1
Aargh. Don't write C# in Python. And _please_ don't use pseudoHungarian notation. It completely misses the point of Python. Also, learn Python idioms. Many of your lines can be written in a clearer, sometimes even point-free way. In some cases you don't even need to learn new idioms, just use them More
Folding-ale1ster 1
This solution reminds me of that silly task "Count the number of F's". :-D More
difference-McMan 1 1
You don't need list(). And you don't need len() either. ;-) More
recursive sum-McMan 1
Why didn't you just put s=0 in line 1, then you don't need line 2 at all? Also, len() is unnecessary. Sequences are boolable. More