57
veky
22 48 64 Leader of the month
44583/ 53887
Last seen 15 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-lsdda 1
Lines 2, 3 and 4 can be written at once: tlist = list(filter(str.isalpha, text.lower())) or if you don't like unbound methods, tlist = [x for x in text.lower() if x.isalpha()] Line 5: please avoid semicolon if in any way possible. "show, counter = 0, []". BTW why "counter" name f More
First-Cairnarvon 1
This one is really cool. Even "else return None" is not needed, I think. 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
Startswith-Timestreched 1 1
"if len(queue) > 0" is just "if queue". 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-martin.beseda.3 1 1
I think it was easier to check char by char. :-) More
Complex nums again-ale1ster 1 1
Too many lists and lambdas, but a nice idea. :-) More
First-Sim0000 1 1
Similar to mine but of course much longer. :-] More
First-gyahun_dash 1 1
avoidable(p, q) = all(map(int.__ne__, index(p), index(q))) Many people don't know map can take more than 2 arguments. :-) Also, for spam in (blah for eggs in ham): yoord is really nicer written as: for eggs in ham: spam = blah yoord Also, you can More
First-fishiwhj 1 1
Line 18 is wrong. rounded gamma is _not_ necessarily equal to 180 - rounded alpha - rounded beta. BTW why do you reinvent the wheel (in this case, builtin round function)? More
namedtuple-Sim0000 1 1
namedtuple('complex', 'real imag') is better, it supports more operations. ;-) More
First-pohmelie 1 2
Line 17 is really pointless. :-) You don't need zip inside map. map(sum, p, dp) is ok. Start of line 23 can be written: np in m.keys() - visited. Not very useful here, but good to know: keys is a set-like object. More
64 chars-Sim0000 1 1
Mine is shorter, mine is shorter... :-P More
truth table-shota243 1 1
ROTFL. But it would be way more cool if you mapped OPERATION_NAMES to symbols from "∧∨→⊕≡" instead of relying on indexes. This is not maintainable. ;-P More
bad but surprise-magdre 1 2
What's bad and what's surprise here? (except CiO Python finally supports yield from:). I consider isinstance(x, list) a bit nicer than type(x) == list. And it will work for subclasses of list too. ;-) More
First-enkeyz 1
Nice usage of conditional expression. However, it would be much nicer if you explicitly checked n in range(len(array)), or at least 0<=n< len(array). I know of preconditions, but it's not much harder to write those additional conditions explicitly. More
First-pohmelie 1
Now when people ask me how dimpleqonx works, I'll just point them to your code. Thanks. :-D More
First-bukebuer 1 1
Here is your code, halved: import itertools, operator def trim(lists): if lists: first, *rest = lists for t in [first] + [first[::-1]]*(first[0]!=first[1]): for remains in trim(rest): yield [t] + remains else: yield [] def sqgen More