49
Phil15
30 56 64 Leader of the month
23157/ 25141
Last seen 1 hour ago
Member for 6 years, 3 months, 11 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
Look at as few points as possible by dividing the rectangle until it is too small-Phil15
To know how many points the function look at, it is easy. `_point_is_covered_by.cache_info()` has all the informations you want. result = _is_covered(room) infos = _point_is_covered_by.cache_info() # Print or log some informations such as: print(f'{infos.misses} points tested for th More
First-bourbaka
area = area.union(one_rec(rec)) # or just area |= one_rec(rec) More
First-alexandrov.net
`for x1, y1, x2, y2 in recs` is simplier More
First-mortonfox
Personaly I don't like too much "append", I prefer to yield things. Less code can be more readable. It still not readable enough for me (too much indexes) but it's a start. def rectdiff(r1, r2): if r1[0] < r2[0]: yield r1[0], r1[1], min(r2[0], r1[2]), r1[3] if r1[2] More
may the force be with you-juestr 1 1
I'm not sure I would call it clear, but I like the way your getter/setter functions manage multiple arguments, and the use of `reduce` I think. More
No lambda, 14 variables-PythonWithPI 1
It's because you can access builtins (thanks to `vars()`) as a dict and not as a module like it should be, so this would not work outside checkio editor. Maybe I should have forbidden divmod function in builtins. (I suppose it calls it somehow, it's hard to decode with vowels replaced by "a".) Then More
[wrong code] unions of sets and resolve all conflicts-Phil15
The part 2 has the wrong interpretation of the lexicographic order. See [my new code](https://py.checkio.org/mission/determine-the-order/publications/Phil15/python-3/compare-deduce-choose-with-lexicographic-order/) to see the right one. With `words = ['word', 'spread']`, the answer is `'spworead'`. More
First-PythonWithPI
WOW, it's totally unexpected! From what I understand, `V[S[2:14]][S[4506:4512]](x,10)[0]` is equivalent to `vars()['__builtins__']['divmod'](x,10)[0]` so `divmod(x, 10)[0]` which is `x//10`. I tested it first on a shell on my machine before the checkio editor, it did not work on my machine. `__buil More
Pearls in the Box-IRONKAGE
More creative than clear IMO. No need of parenthesis around `float` or around no rounded result: `round((...), 2)` -> `round(..., 2)`. 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
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
First-derrickding95 3
`range(len(...))` is useless is most cases, `enumerate` is great: for i, (A, B) in enumerate(pairs): ... I don't understand why you use `deepcopy` since there is no change in tree variable. And the final `return` (in `search` function) is useless too. More
First-yoichi 1
for subtree in tree[1]: if result := find_node(subtree, node): # python 3.8+ return result # No need to return None, it returns None when it does not encounter any return statement. You call `find_node` a lot. Hopefully I did not provide too big trees in random tests. 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
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
[4-liner] 170 chars-Phil15
Clear version of this solution [here](https://py.checkio.org/mission/on-the-same-path/publications/Phil15/python-3/15-lines-timing-a-single-dfs/). More
First-JingMeng 2
L[0 if (20 > age or 40 < age) else 1] # or just L[20 <= age <= 40] Why does it work? `20 <= age <= 40` is a boolean True/False, which are integers: `True == 1 and False == 0`. More
First-Sillte 1 1
`lambda x: str.strip(x)` is the same as `str.strip`, just more complicated. Comments this way seems unusual to me: `# Currenlty, only ``int`` is considered.` for example. More
How do I optimise my code? Write your opion in the comments-Frazer-dl
write a function to avoid to write the "same thing" three times: def some_function_name(a, b, c): return round(m.degrees(m.acos((a ** 2 + b ** 2 - c ** 2) / (2 * a * b)))) `while` should be `if` `return [0, 0, 0]` is enough, no need to write `list(some_list)`. More
Clean OOP Solution with full inheritance-bsquare 1
### Timings Well first, I executed your code on all check tests. It is (with debug lines commented, because create strings for these lines took time) **2.4 times** slower than mine. Thanks to `import cProfile; cProfile.run('''tests block''', sort='tottime')`, I know it's because of `next_living_war More
1 2 3 4 5
6
7 8 9 10 11 12 13