49
Phil15
30 56 64 Leader of the month
23067/ 25141
Last seen 8 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
*Light Up Solver-JimmyCarlos 1 1
First, great job you did it!! It was though, right? I hope you enjoyed it :-) Line 137, I would have write except AssertionError instead of catching every exception? Maybe it catch the exceptions you raise too? I would have do this class SolverError(Exception): pass # then raise Solver More
7-liner: guessing accumulate idea-przemyslaw.daniel 1 1
I would say this is more creative than clear (for merger and last line) but it's great that you do the job with 7 lines. More
First-Sillte 1 1
Wow, more than three hundred lines of code/comments before my checker function. Impressive. I hope you enjoyed it enough! It's not that obvious, looking at it ^^ I don't have the courage to read it right now but I will try someday. Right now, I only have the keywords: constraints, backtracking, OO More
First-Sillte 1 1
Great job, you did it!! :-) Yeah, copy huge things or very often is time consuming. Naive DFS is not really possible here. It can be interesting but only for small searches. I'm not sure reading your code: are you using arrows in both ways? (if my question is clear enough...) Or can you explicit More
Short but inefficient-HeNeArKr 1 1
There is, hopefully, another way to guarantee that without sorting the entire set, your key function just have to be more precise, with lexicographic order. lambda x: (abs(x-target), x) More
Cleaned version, should be reable, it's fast and efficient-Ylliw 1 2
You told me that your solution is slower than mine (absolutely no shame in that, you solved it and it was definitely not a moderate mission, right?). I didn't read all your code but it seems you use `deepcopy` a lot, I can bet it takes you some time. my code don't do any copy of anything (well, ther More
First-colinmcnicholl 1 1
Private messages could be useful. You removed your entire forum post, not just the last comment. So I don't really have a proper way to contact you. I see where is your mistake, your justified lines ends with whitespaces. Otherwise, it's good and can pass all tests. This message will be removed af More
First-colinmcnicholl 1 1
Great job with numpy! Even if I prefer my way with complex numbers. `cmath` module could do a part of the job for you. And there is probably a way to do graham stuff with complexes. `a[randint(0, len(a) - 1)]` or `choice(a)` (from random too). `del sorted_pts[...]`, not `sorted_pts.pop(...)` ? More
First-aya.kanazawa 1
`roots` could be a list instead of a dict. More importantly, since you only need the last element in roots, root could be the last element. roots = [(1, w_count, b_count)] for _ in range(1, step + 1): # don't need n variable anymore nlist = [] for root in ro More
First-brispol19 1 1
# line 8 type(tree[0]) is str or type(tree[0]) is int # or isinstance(tree[0], (str, int)) # line 19 [x for x in iterate(tree)] # or list(iterate(tree)) # line 27 tree = False # or just break # since it does the does the same thing in a clear way More
Recursion-Freez 1
`min` has a default parameter that can be useful. And `len` is great function on its own. min(variants, key=lambda x: len(x)) if variants else False min(variants, key=len, default=False) More
BFS-rossras 1
Sum comprehension is great. def is_adjacent(i, j): '''Return true if x and y differ by one digit, false otherwise''' return sum(i_digit != j_digit for i_digit, j_digit in zip(str(i), str(j))) Great job! More
Zigzag McQuack-Ilis 1 1
About `[[]] * rows`, be careful. >>> L = [[]] * 5 >>> L[0].append(1) >>> L [[1], [1], [1], [1], [1]] # Same object five times. More
1-liner-Stensen 1 1
After I deobfuscated it, I would change `[...].pop()` for `next(...)` since it has a single element. And since we are in creative section, I would even add it is shorter by 2 chars. Or even shorter `[...][0]`, but I prefer next. _Next_ deobfuscated version: from calendar import Calendar fr More
First-Chazlar 1
* the second return is useless. * you could list words on the sentence, then join them with spaces def morse_decoder(code): word_list = code.split(' ') words = [] for x in word_list: chars = [MORSE.get(z) for z in x.split(' ')] # or MORSE[z More
Respect the grid boundaries & Play With DIRS navigation-Stensen 1 1
I don't see why you need to catch index errors since you check `_c` and `_r` are good. Plus `r` and `c` are good names. def count_neighbours(grid, row, col): return sum( grid[r][c] == 1 for move in DIRS for r, c in [map(add, (row, col), DIRS[move])] More
Dijkstra algorithm for weighted graph-2010min0ru 1 1
I like to refactor a bit so here: types and a few simplifications/tricks... ```python from collections import defaultdict from typing import Defaultdict, List, Tuple # GraphCosts = defaultdict(lambda: defaultdict(int)) # Not a type but a dict. GraphCosts = Defaultdict[str, Defaultdict[str, int]] More
13-liner: check every single words permutations-Stensen 1 1
`[crossword[i] for i in (0, 2, 4)] == crossword[::2]` More
Lateral thinking-Samuele_Baracani 1 1
Great, I think I did not thought of `title` method. But to make it a bit simplier: def to_camel_case(name): names = name.replace('_', ' ') return names.title().replace(' ', '') # delete spaces `join` is not the only useful method 😉 More
As simple as I can-Samuele_Baracani 1 1
You do not need to make a list, args is a tuple (which is "like" an immutable list). # example: checkio(1, 2, 3) # args = (1, 2, 3) (type tuple) # your list: [1, 2, 3] (type list) # there are not the same but they behave the same in this situation. def checkio(*args): More
1 2 3
4
5 6 7 8 9 10 11 12 13