23
brubru777
8 23 36
3032/ 3195
Last seen 2 years ago
Member for 8 years, 8 months, 28 days
Difficulty Normal
Best reviews / Newest reviews
First-Oleg_Domokeev
This doesn't meet the "less than 140 characters" constraint. More
The walrus-lrnx
Hi, You forgot to remove the regex import. I really like how you used the new assignement syntax. Very nice! More
First-archana.narvaneni
Hi, Just a remark. The code ``` if condition: return True else: return False ``` can be replaced by `return condition` (much simpler). Similarly, ``` if condition: return False else: return True ``` can be replaced by `return not condition`. More
First-Oleg_Babaev
Hi, Just a remark. `True if condition else False` can be replaced by `condition`. Similarly, `False if condition else True` can be replaced by `not condition`. More
re-BumKlatsch
Very nice use of regex. Also, I didn't know it was possible to combine string types (raw and f-strings). More
(O_O)-sytchov1
Hi, Your solution is correct but a bit long and inefficient. Sorting a list takes O(n log(n)) while looknng for a minimum is just O(n). It's not that bad because sorting is still reasonably fast but you are adding unnecessary complexity. To improve your code, you could do a single for loop. In it More
First-PythonLearner
Hi, Instead of `split`, you could use `find`, which is more efficient in this case since we only need to get the first "word" after =. if index == -1: return "" end_index = cookie.find("; ", index) return cookie[index:] if end_index = -1 else cookie[index:end_index] More
First-RomanTT 1
Hi, You're computing `len(text)//2` three times. It would be nicer to use a local variable to store this result. More
Compass, Map and Spyglass -Michal_Szajer
Hi, You're scanning the whole map three times. A more eficient way would be to scan the map once to find the objects, then to compute the distances. Also, `sorted(a, b)[1]` is just `max(a, b)`. More
for loops-flpo
This solution is much more elegant and efficient than most of othesr which unnecessarily make extensive use of zip and sums. More
Counter-Sim0000 1
Most elegant and efficient solution I've seen. More
First-stum74 1
Instead of `n > len(array) - 1`, I find `n >= len(array)` more natural. But that's just a detail. More
First-ki1ler
Hi, The `return None` is unnecessary. Since either the `if` part or the `else` part is executed, the `return None` can never be reached. More
Index Power-yg271334757
Using `range` is a bit overkill. A single < is enough. Or `0 <= n < len(array)` if you want to check the lower bound too. More
Second-dandd31 2
`is_alive` should be a "property". To keep it simple, a property is a function which can be invoked like an attribute. Here's the syntax: @property def is_alive(self): # return something More
My First, Using Decimal-d_rabenko
Hi, Did you know that to get a number with two decimal digits, you can just use `round(number, 2)`? More
First-fokusd 1
Simple and elegant. I love it. More
First-gwhitehead77
Hi, There's a very small modification you could make to improve your code. `len(new_line[0:j])` is just `j`. . More
First-gsbullmer 1
Sure. With your algorithm, you check every value between the min and the max. If max - min = 1,000,000,000, you're going to check 1,000,000,000 numbers even if the array has only two elements. If you sort the array first, you only need to check pairs of consecutive numbers in the array. If their d More
First-ciel 1
Hi, You can improve your solution by storing the characters' position in the dict instead of the occurrences. Then you can replace the while with a constant-time expression. That'd make your algorithm linear-time. Also, in the last if, you can keep the best head and tail and generate t in the retu More
1
2 3