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-Wienands 1
`sum` is a Python keyword, you shouldn't use keywords for naming your variables. The correct usage of `sum` (as a function) would be if you replaced lines 20-23 with: return sum(users[node] for node in all_nodes.difference(next_nodes)) Lines 7-9: you can use tuple unpacking directly in the for More
First-o_Orlova
Last three lines could be replaced with just: `return abs(days)` More
First-minto
This is a random review so I don't know if anyone commented the same thing already, but: You are creating way too long list of triangle numbers. There is a condition that input number is less than 1000, so there's no point of triangular numbers higher than 1000 in that list. (As a matter of fact, t More
Non-unique Elements-Gaydar
Interesting approach - usually people create an empty list and then append to it values that appear more than once. Also, you might want to know about [list comprehensions](https://docs.python.org/3.5/tutorial/datastructures.html#list-comprehensions) More
Non-unique Elements_solved1-bassnao37
Couple of things here: 1. Is your line 16: data= newdata really necessary? Why you don't just: return newdata --- 2. Lines 11, 12, etc: for i in range(len(data)): cnt = data.count(data[i]) can be replaced with more 'pythonic': for item in data: More
Simple-Sisyphus
Your first line could be written as: stripped = [c.lower() for c in text if c.isalpha()] More
First-kolyandr2
You could slightly simplify your lines 5, 6, 7 with: if 0 <= k < len(grid) and 0 <= n < len(grid[0]): if (grid[k][n] and (k!=row or n!=col)): s += 1 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
What about symbols?-GER007ALD
There's no need for 3 separate for-loops: def checkio(data): length_check = len(data) >= 10 digit_check = False upper_check = False lower_check = False for char in data: if char.isdigit(): digit_check = True More
First-5_oxygen
Since you use 'amount/2' in three places, isn't it better to define it as 'len(data)/2' and then just use 'amount'? And your if-clause can be then done as 'if not len(data) % 2:' More
Moore Neighbourhood-narimiran 1
Changed the line 8 to: neighbours = sum(sum(hood) for hood in neighbourhood) since @veky said in a recent comment that sum is "clearer, faster and more consistent with that subtraction later" than count. More
First-wangxuan890
Line 4 - there's no need for subtracting 1 from the length of data, so you'll just have 'len(data)//2' - notice the // - that's integer division, so you don't need 'int' in front of your expression. And now you'll have that expression in three places in your code - you could introduce new variable 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
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
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
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
FastBall-morpho4444
Line 23: rather than use string concatenation, using format is preferred: def __repr__(self): return 'Building({}, {}, {}, {}, {})'.format( self.south, self.west, self.width_WE, self.width_NS, self.height) More
First-patrat88
Line 27: rather than use string concatenation, using format is preferred: def __repr__(self): return 'Building({}, {}, {}, {}, {})'.format( self.south, self.west, self.width_WE, self.width_NS, self.height) More
First-jollyca
Line 30: rather than use string concatenation, using format is preferred: def __repr__(self): return 'Building({}, {}, {}, {}, {})'.format( self.south, self.west, self.width_WE, self.width_NS, self.height) More
First-ashish420
'word' and 'text' are already strings, no need for converting them to string (line 4) More
1 2 3 4 5 6 7 8
9
10