13
Jakob van Bethlehem
Last seen 5 years ago
Member for 10 years, 4 months
Difficulty Normal
The explicit _bool()_ conversion can be removed, as you are already working with booleans
More
I came up with the same idea, so I like it (+1), except that you destroy the input list. I don't think the users of your code expect that to happen (-1) ;)
More
Why do you call it not nice? What would you rather have written different?
More
Hm, somewhere in the back of my mind I knew of this _for-else_ construct. But in this particular case I don't think it does anything, does it? Or in other words: if you would remove the _else:_, and just type _return False_ as the last line, nothing would change, would it?
More
I tried a EAFP approach first as well, until I realised that a negative index is not a problem in Python. Then I had to change it to something that more or less does the same as your solution, except that I used some different constructs.
What I don't like about this particular implementation is th
More
There are quite a few things here that could use improvement:
* Don't set _r_size = len(grid) -1_ and then do _i <= r_size_. Rather just compare _i < r_size_ - this is much more 'standard' in all programming languages that exist
* Comparing a boolean value against _False_ is as bad as it gets, agai
More
Excellent solution, reminding us all of the possibility to add a step to the slice operator
More
You could skip calculation of the average, because _len(l)_ will be the same for each row, or in other words: _index(max(sum))==index(max(avg))_
More
You also destroy the input list - I'm not sure the users of your code were expecting that to happen!
More
Hm, to me straightforward is not the same as clear - comparing this solution to others, I think the category 'clear' is not quite correct - it should probably be 'creative', as it took me quite a while to figure everything out
More
Why adding a default argument to the _checkio_ function - just define marks as the first line in the function body
More
I don't think you need to call the _data[:]_ syntax a 'trick': it is really just standard Python; used by a lot of code out there when in need of a copy of a list
More
You were probably not aware yet of the _**_ operator in Python? See https://docs.python.org/2/tutorial/introduction.html#id1
More
Instead of _reversed(range(a, b))_ you could also use the simpler _range(b-1, a-1, -1)_. And instead of setting the _changed_ variable and checking for it, you could use the _for-else_ syntax
More
I see _return 'D'_ twice .... a clear indication that the algorithm needs improvement
More