22
siebenschlaefer
10 27 32
2866/ 2945
Matthias
Last seen 2 years ago
Member for 8 years, 11 months, 28 days
Difficulty Normal
Best reviews / Newest reviews
Absolute sorting-lukas.linhart 1
FYI: ``sorted()`` takes an optional keyword argument *key*. More
First-PriyaranjanReddyJC 1
Since you filed your solution as "Clean": - You could use more expressive variable names, e.g. `lines` instead of `a`, `max_length` instead of `l`, etc. - Instead of initializing and incrementing a counter in lines 5 and 9 you could use a common python idiom `enumerate`: `for i, x in enumerate(x):` More
First-bukebuer 1
FYI: ``lambda x: abs(x)`` is equivalent to ``abs``. More
First-blabaster 1 1
FYI: You could use `mask = 2 ** second.bit_length() - 1`. More
First-yoichi 1
FYI: In Python 3 you can write ``h, m = map(int, time.split(":"))`` More
Easy-globex 1
- You could replace the magic number ``4`` with ``calendar.FRIDAY``. - Instead of constructing a list and then using its length you could use ``sum()``. More
First-oliwiam96 1
FYI: Your function `binary(n)` is equivalent to `bin(n)[2:]`. More
Random fact: The total number of steps in the Eiffel Tower are 1665.-siebenschlaefer 1 1
Your comment sounds like one of the key points of [Structured Programming](https://en.wikipedia.org/wiki/Structured_programming). But I've read about this from other experts who advise against following the _single return statement_ policy too religiously. One of the most prominent ones is Steven M More
First-Sayan 1 1
Donald E. Knuth, one of the most famous computer scientists, wrote that *the bubble sort seems to have nothing to recommend it, except a catchy name and the fact that it leads to some interesting theoretical problems*. Please consider using Python's builtin functions ``list.sort()`` and ``sorted()`` More
numbers_array1-DJO3 1
FYI: ``sorted`` takes an optional keyword argument *key*. More
C-lukas.linhart 1
* ``set.add()`` and ``set.discard()`` always return ``None``, so ``return not ...`` saves you an additional ``return True`` but is slightly confusing. * ``Friends.connected(self, name)`` does contain ``name`` even if ``{name, name}`` is in ``self.connections``. More
Clear-jango1 1 1
FYI: Python 3 dropped support for the *cmp* keyword argument. You might consider using the optional keyword argument *key*, which is also much more efficient. More
First-Lipen 1
FYI: You are working on a very low level. You might want to consider using `datetime.datetime` and `datetime.timedelta` objects, which allow time arithmetic and have methods like `strptime` and `strftime`. More
First-tanukitchen 1
FYI: You could replace the two operations on line 4 with ``ldiv, lmod = divmod(l, 2)``. More
First-MMM_AAA_NNN 1 1
Since you filed this under "clear": Don't you think linke 5 would be clearer as ``return int(bitcom, 2) == pattern``? More
First-tihenko 1
FYI: Instead of three `for`-loops you can use `itertools.combinations(cakes, 3)`. More
Humpty Dumpty Form-resilience 1 1
FYI: Instead of `float("{0:.2f}".format(vol))` you could write `round(vol, 2)`. More
Funny adition-Riddick 1 1
If you want to keep it as short as possible you could write ``sum(a)`` instead of ``a[0]+a[1]``. More
Sorted-CounterSparta 1
FYI: ``lambda x: abs(x)`` is equivalent to ``abs``. More
First-yoichi 1
Since you filed your solution under "clear": You could avoid some repetition by rewriting ``go``: ``` def go(p, q): moves = ( (-1, -2), (-1, +2), (+1, -2), (+1, +2), (-2, -1), (-2, +1), (+2, -1), (+2, +1)) for dp, dq in moves: new_pos = (p + dp, q + dq) if al More
1
2 3 4 5 6 7 8 9 10