22
narimiran
7 24 41
2882/ 2945
Last seen 5 years ago
Member for 8 years, 4 months
Difficulty Normal
Would like to receive comments/critics of my published solutions.

Best reviews / Newest reviews
First-zcjsword 1 1
Your first two lines could be written easier/simpler with: text = text.lower().replace(' ', '').splitlines() (This is a random review, sorry if this has already been mentioned before) More
Iterate, Comparisons, Sum Operators (and, or, xor), Combine Result-John.Hammell 1
Line 7: you don't have to have '0b' to convert binary number to an int, creating empty strings would work too. Lines 11 to 26 could be simplified by using operators and, or, xor - no need for all those conditions. for x in a: and_sum = ""; or_sum = ""; xor_sum = "" for y in b: More
Second-rajesh27071992 1
Line 2 - you can sort the original list, without creating a new variable by using list1.sort() This "int(len(list2)/2)" you use three times - it would be better to create a new variable (before the if-loop). Also, there exists //, which is integer division so you don't need to convert to int. More
First-finpingvin 1 1
This is a random review so I don't know if it's been already said because I don't see other comments, but: Why not make _first and _second a sets, so you can do intersection as well.... intersection :) def checkio(first, second): _first = set(first.split(',')) _second = set(sec More
Repetitio est mater studiorum :D-suic 1
Not nearly enough cases.... See [here](https://py.checkio.org/mission/fizz-buzz/publications/jesaispas/python-3/i-know-switch-case-are-better/) :D :D More
First-ljy95135 1
Line 10: return str_b.rjust(8, '0') Similarly, line 38: str_b = str_b.ljust(32, '0') Lines 40-45: str_ip = '.'.join(bin_without0b_8bit_to_ip(str_b[i:i+8]) for i in range(0, 32, 8)) More
Second-Igor_Nikolaev 1
Function `make_graph` - instead of using `node[0]` and `node[1]`, it would be more elegant to use tuple unpacking in the for loop. Also, you can use `defaultdict` to avoid checking if a key `node[0]` already exists (lines 5-8). Putting those two things together: from collections import defau More
First-Sorrop 1 1
Instead of doing all that in lines 19-30, you could have sorted both lists and check if they're the same: first_list.sort() second_list.sort() return first_list == second_list There are also more clever ways of making those two lists, but I won't complicate now :) (but if you want, More
First-gaa7par 1 1
Line 8, why not: median = data[median_plus] Also, is there a need for 'median_minus' when you can have it just as 'median_plus - 1' when needed? More
weak_point-Romissevd 1
There are couple of missions here where you’ll need to transpose a matrix, so I think it’s a valuable to know an elegant way to do so - your line 3 can be written as: sum_col = [sum(x) for x in zip(*lst)] More
First-plubius3 1
Line 8 - there's no need for list comprehension from the existing list of factors, you can just do: return int(''.join(reversed(factors))) (I prefer 'reversed' rather than 'sorted' because we know for sure that list of factors is in descending order) More
Moore Neighbourhood -- First-Vincent_Fan 1
[NO GOD PLEASE GOD NO](https://i.giphy.com/12XMGIWtrHBl5e.gif) :D :D (I've seen your second solution, so I guess there's no need to explain anything here :D) More
First-kapranowroman
There are couple of missions here where you'll need to transpose a matrix, so I think it's a valuable to know an elegant way to do so (it could have saved you some time and trouble here): transposed = list(zip(*matrix)) More
dededeque!-BoomGoesThe
Lines 6 and 7 - you always append just the last (one) character, so there's no need for splitting 'item' and creating temp, you could just do: dedede.append(item[-1]) Lines 8 - 12: I see no point in lines 11 and 12, and you can have only one (el)if to cover both conditions: elif "POP" in More
FastBall (You shit fuckers love 1 lines)-morpho4444
By using // you'll lose all those 'ints' and your cryptic list-comprehension becomes a bit more readable: def checkio(data): data.sort() return (data[len(data)//2]+data[(len(data)//2)-1])/2 if len(data)%2==0 else data[len(data)//2] More
First-agtorre
'sum' is a name of the Python's built-in function - avoid naming your variables the same. But if you want to use 'sum' (the built-in one :)), there's a way to simplify your last 5 lines of code: return sum(grid[row][col] for row,col in coords) More
Max Sydney-MaxSydney
Lines 7 and 8 - instead of writing else and then if, there is 'elif' that does exactly that. Also, you can check if there's something in 'queue' by knowing that empty list returns false, so your else-part now becomes: elif queue: queue.pop(0) More
First-kiazo1
Some simplification you might find useful: Line 6: when splitting by whitespace, you can write just: something.split() ...but here you don't even have to split, because you always append just the last (one) character, so that line becomes: q.append(com[-1]) --- Line 8: empty list returns More
First-birds_vs_worms
You don't have to use 'int' and 'length - 1' if you use // - that's integer division (or to be more precise - floor division). So 'mid' can be defined only once for all cases. It would look like something like this (lines 2 and 5 are also slightly changed): def checkio(data): data.sort More
First-kiran.talapaku
Why you first define x = 0, then change it both in 'if' and 'else'? Just make it x = n/2 at line 4 and that's it. Also, there's no need for the second 'if' at line 7 - just use the expression from line 10. Here it is what it looks like with those changes: def checkio(data): data.sort( More
1
2
3 4 5 6 7 8 9 10