40
suic
16 39 57
9964/ 10664
Last seen 4 days ago
Member for 9 years, 10 months, 19 days
Difficulty Advanced
Best reviews / Newest reviews
First-ryosms
A few comments: 1. In fact lines 5-7 are superfluous as a, b and c don't have to be sorted. 2. Then: a, b, c = length is the same as a = length[0] b = length[1] c = length[2] 3. Consider creating a separate function from: round(degrees(acos((b * b + c * c - a * a) More
Second-ultrajack
Good job! There's no redundancy. And it's even safer than it has to be, as all inputs in the tests are already sorted :) More
First-Plazer
You don't have to use third variable two swap values of two variables. You can simply write: if n < m: m, n = n, m instead of: if n < m: tmp = n n = m m = tmp More
First - The Hamming Distance-AQiccl135 1
You can use the [str.rjust](https://docs.python.org/3/library/stdtypes.html?highlight=str.rjust#str.rjust) method for this: fill = abs(len(n) - len(m))*'0' if len(n) < len(m): n = fill + n else: m = fill + m More
using "bitwise exclusive or"-johnhaines
Why not return bin(n ^ m).count("1") ? More
First-tkm-tyler
In this case you can use _int_ instead of _lambda c: int ( c )_. More
First-subaru
_nbin_ and _mbin_ are both _str_ which is iterable there for using list() in lines 10 and 11 is superfluous. And also you can write: size = max(len(nbin), len(mbin)) More
Even the last (Solve)-Yoratheon
Few tips: array[len(array) - 1] == array[-1] # there's no need to write len(array) n = n + 1 --> n += 1 0 % 2 == 0 # you can omit n == 0 in your if clause The code in else branch doesn't have to be in else branch. More
Index Power (Solution)-Yoratheon
The return None in your code is never reached, you may remove it. More
First-I_s_a_a_c_123
Hi, 1. Line 10 is redundant. 2. You use `len(data)/2` three times, so it's good candidate for a variable. 3. Line 3 is more readable this way, but you could also write it like this: if len(data) % 2: ... More
First-DenGodunov
Hi, this: for i in range(len(data)): if data.count(data[i]) > 1: data_1.append(data[i]) i = i + 1 else: i = i + 1 # could be replaced with: for i in data: if data.count(i) > 1: data_l.append(i) But you can use _f More
Greedy alg with binsearch-Lasica
I'm nitpicking (so don't take it too serious): Romanian numerals? :) rumuński != rzymski. More
Matrix sol. I <3 Fractions.-Lasica
Hi, I like lambdas but in this case I agree with @PaulBrown. One tip to make code a bit more readable: Separate long comment from code, e. g.: # returns sum of 2 rows starting from column fromcol, # where second one is multiplied by mult addrows = lambda row1, row2, mult=1, fromco More
dfs with statics-Lasica
Hi, I would shorted valid like this: return all(0 <= spot[i] < len(dfs.matrix[i]) for i in (0, 1)) More
No if-Lasica
Hi, no if and no slices: `array[::2]`, `array[-1]`. More
Just a loop-Lasica
Hi, look at _any()_ and _all()_. More
Patrick-pdtpatrick
Hi, 1. You could use `int.__mul__` instead of `lambda`. 2. `new_number` is redundant. You can put that comprehension in `reduce` directly. More
Patrick-pdtpatrick
Hi, why not?: return [x for x in data if data.count(x) > 1] More
Patrick-pdtpatrick
Hi, _bin()_ returns __str__, so you could use _str.count()_. More
Patrick-pdtpatrick
Hi, 1. `== True` is redundant. 2. `...if...else...` on line 5 is redundant: new_sentence = [x.isalpha() for x in sentence.split()] # or you could use map new_sentence = map(str.isalpha, sentence.split()) More