49
Phil15
30 56 64 Leader of the month
23067/ 25141
Last seen 5 minutes ago
Member for 6 years, 2 months, 27 days
Difficulty Advanced
I was a math teacher in France for two years. I'm currently reconverting to IT, I'm here to improve my Python skills, and practice English.

Best reviews / Newest reviews
strip and split with \n, zip(*rows)-Phil15
For critical readers: strip('\n') can be replaced by strip(). More
First-mortonfox
No need of sum lists: Counter(ring for cube in cubes for ring in sides(cube)) I did a sum at first too. More
sorted-Cjkjvfnby
I don't like it, why sort all the list when you just want min or max? Bad computational complexity here : if n is the length of the list/iterable... O(n log n) instead of O(n) when you just look the iterable's elements one by one. For me, the purpose here is not use a powerful function like sorted. More
First-colinmcnicholl
Ahah, we wrote the same code. They are minor changes obviously but it is the same. More
First-Jonethan
* Use else when needed, we exit the function when we `return` something. * `not ... == ...` is the same as `... != ...`. * A number that does not finish with a zero does not seem to be a special case to me, but 0 does. * You do not really use the index, but you want to iterate on the string in a rev More
First-meta77fora
Do not overuse parentheses, while, return and ... are not functions: def beginning_zeros(number: str) -> int: i = 0 while number[i] == "0": i += 1 if len(number) <= i: break return i # It can even be def beginning_z More
First-helebed
You do not use x at all but the digits of the number so just iterate on them def beginning_zeros(number: str) -> int: count = 0 for digit in number: if digit == "0": count += 1 else: break return count More
DFS-drpepper1412
List/Dict comprehension is good def convert(grid, points): return {grid[i][j].lower(): (i,j) for i,j in points} path = [(i, j) for i, row in enumerate(grid) for j, cell in enumerate(row) if cell.lower() == check[0]] Your count variable is a li More
Find the 1st father then all easy-rockwellshabani 1
- Sets are great, fully use them. - `sorted(list(x))` and `sorted(x)` are both good, sorted function accept any iterable, sets included. - I prefer used named variables to indexes and only use `_` for variable I do not use. - I made a few changes and comments. ```python from collections import Coun More
First-Chazlar
* I prefer `for a, b in ...` at `for x in ...: x[0], x[1]`. * tuples: please `(a, b)` not `tuple([a, b])` * list/set/... comprehension is good. * `abs` is optional but kind of appropriate here. * I'm pretty sure sets are not useful for you here, lists should be enough. Sets could be good with a More
First-Chazlar
Great use of Counter [elem for elem, count in counter.most_common() for _ in range(count)] More
First-panama555
N = len(matrix) # == len(matrix[0]) for y in range(N - 3): for x in range(N - 3): ... then `if` are much easier!! More
First-kazuki.h
def four_more(i, j, d_1, d_2): for t in range(1, 4): if matrix[i][j] != matrix[i + d_1 * t][j + d_2 * t]: return False return True # or def four_more(i, j, d_1, d_2): return all( matrix[i][j] == matrix[i + d_1 * t][j + d_2 * More
Sol. with explanations-davydavi 1
First I don't see the point of pandas here (and it's a bit curious to me you can import it ^^). Your DN you entirely write can be easier. from string import digits, ascii_uppercase DN[L] can be replaced by (digits+ascii_uppercase).index(L) (and then forgot DN) You should consider learn li More
First-koyana222 1
`([0-9])\1{3,}` is a simpler pattern. I would want to simplify what's next too, such as: for row in matrix: row = "".join(map(str, row)) if regex.search(row): print("a") return True More
9-liner: BFS-Phil15
I noticed that it's faster with `(speed + 1, speed, speed - 1)` than with `(speed - 1, speed, speed + 1)`. It makes sense: acceleration prefered to deceleration. `0 < s <= end - pos` is shorter and equivalent to `pos < pos + s <= end` (new_pos is between pos and end). More
Ascending List-cc41516
return items == sorted(items) and len(set(items)) == len(items) is really enough. More
Polynomial coefficients-rodka81
Just great! Well used and documented! More
First-Anton_Prokopovich
Don't understand why you add spaces if it's for replace them by `_` after. BTW, there is a much better way to replace ' ' by '_', it's `your_str.replace(' ', '_')`. If you really need the alphabet, you can write `from string import ascii_uppercase as alphabet` (or `ascii_lowercase`). It can be usef More
First-fed.kz 1
Don't see the point of a dict here: `count` seems to be like a list `count = [0, 0, 0, 0, 0, 0, 0]` and `max_days = max(count)`. More
1 2 3 4 5 6 7 8 9 10
11
12 13