49
Phil15
30 56 64 Leader of the month
23067/ 25141
Last seen 7 hours 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
First-DEADPOOL 1
`if res[i] != True` then `res[i]` is already `False`. so lines 7 - 11 can be much shorter. Plus two pythonic changes: def stones(pile, moves): res = [True] + pile * [False] for i in range(1, len(res)): for j in moves: if i - j > 0 and not res[i - j]: More
Simple-petr.synek.phd
Hi! Found that weird marked = marked|set().union(*newly_marked) # Instead I suggest marked = marked.union(*newly_marked) # or if update the set "marked" IN-PLACE is okay (I think it is) : marked.update(*newly_marked) and indexed_circles = [(index, circle) for index, circ More
One liner-petr.synek.phd 1
Well if `i != 0` then `i - 1 >= 0` "1" if val == line[max(0, i - 1)] and i != 0 else "0" str(int(i != 0 and val == line[i - 1])) More
[typed] Coroutine, filters, cached expressions-Phil15
I think the "checkio" function should receive only one “step info” each time and process it, instead of giving the entire history, and a coroutine is a good way to do just that. Plus, it's a rare occasion to use `typing.Generator` in a meaningful way. More
Clear-U.V 1
Don't you think you spam published solutions?! 6 (very very similar) published solutions. 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
+8 is not enough for this task =)-Kolia951
As the mission author, I receive emails about new solutions and saw the title of your solution and I'm glad you liked my task. =) 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
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
Polynomial coefficients-rodka81
Just great! Well used and documented! More
2 Solutions in 1-Alex_4444D
About the first, first... what about list comprehension? Second, I'm pretty sure it should not work. It counts the number of email addresses with "." or "+" in the name part. Plus, case would matter, and duplicates would be counted multiple times. ```python def unique_emails(emails: list[str]) -> i More
First-Alexandra_Berger
`text == text.upper() or len(text) == 0` is already a boolean True/False, just return it. No need of `len(text) == 0` since `'' == ''.upper()`. return text == text.upper() More
str-Phil15
If you are reading this solution and asking yourself why this solution can even be publish (the function signature being clearly incorrect), it's because: 1. The mission (at the very beginning) did not have the second parameter which was latter added (to make it really different from another palind More
recurse-ojisan 1
No need to put parenthesis around the thing to return, just `return result`, it's not a function. if ...: return ... # else: # no need of else since return stop the function. return ... No need to make a list to sum elements sum([next(n,depth+1,weight*m) for n,m in branch More
1 2 3 4 5 6
7
8 9 10 11 12 13