57
veky
22 48 64 Leader of the month
44584/ 53887
Last seen 22 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-michael.kej
Clear? O RLY? :-D That -1 is eyestabbing. :-] More
First-michael.kej
If you really wanted to be _clear_, you'd probably use .count('1') as before. ;-] n &= n - 1 is a nice trick, but not really "clear" IMO. More
First-UndeadMonkey
First realize you can write count += word.lower() in text.lower() And then realize this is just what sum() is made to solve. ;-) More
MedianFinder-UndeadMonkey 1
That -0.5, and int() everywhere, is _really_ ugly. Please learn to use //. It's not hard, and it usually does exactly what you want. Comments shouldn't lie: list is not even nor odd, len(list) is. Line 7 is very strange: why not just divide in place? Calling a sum of two values "avg" is not really More
lots of ifs-UndeadMonkey
First, list is unnecessary. "for entry in expression" works fine. brackets can also be a str, then you can just brackets += entry in line 7. (Yes, it's slower, but not much, and later code becomes _much_ simpler.) Line 6: if entry in "([{". Lines 11~17 (and twice more): if brackets.endswith( More
First run -UndeadMonkey
Really? re.match with literal? How about just "PUSH" in entry? Lines 11, 12 and 13 are just if m. But really, use a .split and be done with it. Or even a slice if you feel dirty. ;-) int(entry[5:]) Also, lines 18 and 23 are just if stack. Lines 19~20: del is cool if you don't need that value. If More
verbose-UndeadMonkey
This is _incorrect_! asin gives values up to pi/2, but angle\_b can of course be obtuse. Write a function for how you calculated angle_c, and apply it three times. Also, math.degrees could come handy. ;-) More
First-Kr1isu
A local function would be nice, to eliminate that huge code duplication. Also, lines 14~17: return first == second. More
First-LewisFogden
Instead of rebinding words, probably inlining would be better: for word in words.split(): This way it's obvious what you're iterating through. More
One line-LewisFogden
You don't need list. sorted takes a set without problems. And if you use .intersection, you don't need second set. .intersection takes list without problems. Of course, probably better is to use set(...) & set(...). Or better yet, write a function for left and right side at one place. More
zip*-LewisFogden 1
Twice again... what's with that? More
First-LewisFogden 1
len(blah) == 0 ~~~> not blah Instead of '{([' and '})]', it would be better to use pairs,keys() and pairs.values(). That way you have a single source of truth, and don't have to think about modifying code in many places if you add a new pair. More
triangle-gyahun_dash 1
Nice formula. How did you get it? :-) More
First-EcNeu
Try getting used to // for int division. It will help you when you switch to Python3. ;-) (len(data)-1)/2 ~~~> len(data) // 2 float is unnecessary if you float your 2: just say / 2.0 . More
First-EcNeu
Again, "answer" is completely superfluous. Just return what you want instead of naming it answer. Line 3: if number % 3 == number % 5 == 0: More
First-EcNeu
Aargh. I_will_return = answer now_I_really_should_return_what = I_will_return its_time_to_return = ... Just return it, man. :-D More
Second-EcNeu 1
Don't single-exit your functions forcefully. Instead of naming it "answer", just return it. Also, "is not None" is unnecessary. Matches are always true if anything is matched. "and" is useful protocol, much clearer than nesting ifs. ;-) <= 64 is unneeded. More
Simple-BoguslawKalka 1
Assigning something to a name just to return it afterwards, _especially_ when that name is the name of surrounding function, is really unnecessary. It would be much better to write def area(self): return self.width_WE * self.width_NS and so on. More
First-Taca
You used list() seven times. _None_ of them was necessary. This must be some kind of a record. ;-P bin(n)[2:] is nicer written as format(n, "b"). Padding with zeros is common operation. See str.zfill. (And max is also nice.;) In any case you don't need _three_ cases. Just two. [0]*(a-a)+l is l. More
First-Taca
Argh, too complicated. Have you thought about a nicer data structure than the sequence of strings? :-o And what do you think line 4 is doing? :-/ You don't need () after while. else in line 18 doesn't do what you probably think it does. Line 10: if not route: More