49
Phil15
30 56 64 Leader of the month
23187/ 25141
Last seen 7 hours ago
Member for 6 years, 3 months, 18 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-Tanis1981
replace_all('o', 'o', 'oo') More
BFS resolution order and backtracking-Phil15
Coming back to it 19 months later, I still understand it clearly. It makes me happy. ✨ And the only thing I would really change is: No need of the variable "okay" in the "possible_words" function: the "else" clause would do the job. changes = [] for rc, letter in z More
easy read-Caloe_Mae 1
`items[begin:end]` and `items[end:]` are already sorted, you just need to reverse them so result += items[begin:end][::-1] # may be possible with one slicing but I'm incomfortable with reversed slices. result.extend(reversed(items[begin:end])) a = items[begin:end]; a.reverse(); result More
First-xiaoxiannv-TangTang
Note that `for each,i in zip(str1, range(len(str1)))` and `for i,each in enumerate(str1)` are equivalent. More
First-michalmikulasi 1
You don't need to iterate on the text. You're almost lucky it even works. def correct_sentence(text: str) -> str: text = text[0].upper()+text[1:] if text[-1] != ".": text += "." return text 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
[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
OOP with dataclasses-rodka81
I finally see a dataclass, thanks! =) More
First-Adrian_Goh 1
Use global variables is usually a bad idea, like here. Honestly it should NOT have pass tests. You only pass them because of "check" part work, and little tests did not warn you about it. assert isometric_strings('add', 'egg') == True dict == {'a': 'e', 'd': 'g'} assert isometric_strin More
First-kurosuke 1
You could use `float('inf')` or `from math import inf` for min_cost. And global variable are tricky to use. You can define a function into another. Then you won't have to use a global variable. def cheapest_flights(): min_cost = float('inf') def cost_calc(): # cost_ More
First-liuq901 1
I would use "for/else" instead of "flag". What do you think? for i in range(1, 101): for j in range(4): if i % prime[j] != attempts[j + 1][0]: break else: return [2, i] More
First-Dmytro_Shlapak 1
def cheapest_flight(costs: List, a: str, b: str) -> int: return min((get_weigth(l, costs) for l in find_all_paths(gen_dict(costs), a, b)), default = 0) default value is returned when the iterable is empty. min([], default=0) == 0 def get_weigth(route, t): More
Unique neighbors and small paths search-Phil15
All tests in a quarter of a second on my computer. Fast enough for me. More
numpy-rodka81
Great use of numpy and scipy! I like the simplicity that these modules offer to your code, except lines 24-31, I would like a function similar to `pad` to reduce the matrix. :-) Or apply pad function only if it's necessary. More
Simple and readable-malion
What would happen with `'[ord(s) for s in "GeneratorExp"]'`? More
short, recursive, max with default argument-Phil15
If the iterable is not necessarily a "list of lists of ... of ints/floats", but an "iterable of iterables of ... of not iterables". def how_deep(iterable) -> int: try: return 1 + max(map(how_deep, iterable), default=0) except TypeError: # not an iterable anymore, re More
Heuristic search for most contentious light-JamesArruda 3
I really like the fact you use **corners** (so +2). I thought about it too, but my solution worked without this kind of deduction. Line 54: `for v in range(1, 100):` or `for v in count(1):` itertools count, it's great. I like to see exceptions raised, but you should create your own exception to be More
First-michalmikulasi 1
`num%2==0` is already a boolean True or False, you can return it. def is_even(num: int) -> bool: return num%2 == 0 More
[creative] Scientific imports + 1-liner: Markov chain-Phil15
Note that when I published this I could not put it in **creative** category where it clearly belongs. More
aligned-quarkov 1
`trees[1:]` is enough, why not `len(trees)`? More
1 2 3 4 5 6 7
8
9 10 11 12 13