11
Peter.White
1 10 28
548/ 645
Last seen 3 years ago
Member for 9 years, 1 month, 28 days
Difficulty Normal
Best reviews / Newest reviews
First-laserpez
**int()** is redundant for a division of integers. Also, it is basically the same as number//other_number More
First - using string.-tigelane
A little complicated. Plus, you don't need **string**. You can use ord() to get the ASCII number of a character and chr() reverses that. You also potentially check _all_ other _pawns'_ positions, but you only need to check _two_ positions and see if there is a pawn on it. And we were given a set, w More
First-jcg
Your comments are misleading: > returns **row number** for pawn p as **"c3"** (first row is 0) And you have five, repeat five, functions? And all are oneliners. Anyway, **is_safe()** checks against all pawns on the board, which you must account for in line 13. Also, the task was to check if a pawn More
First-volatilecat
Could have saved yourself the -97. It's all relative, literally. ;) And **pawns** is already a set, which you basically make a copy of. More
First-Blukano
Your checks on lines 5 and 9 are pointless. You do member checking against **pawns** one lines 13 and 15. So, if you happen to check an illegal position, meaning it is outside the board, it will be a miss anyway. Also, if have to do such checks, < and > are better options in my opinion. One keystrok More
First-barrenzye
Reading your comments I was somehow reminded of [The Zen of Python](http://www.thezenofpython.com/): > Readability counts. > > If the implementation is hard to explain, it's a bad idea. Sorry. But why not simply go through the pawn one at a time calculate where another pawn must be to protect it More
yield each wave-sevaader
Nice demonstration of a generator. Even though I have never used one, your code is very clear and understandable. Maybe I wouldn't have used the arrival metaphor, because the old ones _don't_ arrive, they are there already. ;) But that's about all I have to criticize. More
First-gautamas 1
Your __while__ condition and the __return__ on line 16 are redundant. If __number__ happens to be less or equal to 0, line 6 catches that. And since there is no __break__ anywhere, line 16 is unreachable code. More
First-nooodl
Very nice. I used a dictionary, but I can see the benefit of a presorted list here. More
First-gyahun_dash
I had to giggle a little while reading the code. ;) Very nice. More
First-dubkc
Line 16, while it works in this case, seems like something that could bite you somewhere in the future. Non-unique means the count of the element is greater than 1, so why not make that the condition? That would be a precise transcription of the problem in code. !=1 on the other hand, theoretically More
Non-unique Elements-ezio647
Line 9: Why not >1? Theoretically values smaller than 1 would result in the condition to be true. While not possible here, in my very humble opinion it is bad style to not use the correct condition. Or are there other considerations, I am missing here? More
First Solution-MagicMantis
Line 6: To quote from a hint associated with this excercise: "Don't remove elements from the list which you iterate as it can have unpredictable results..." (bryukh) More
First-netgamer
You're calling len(data) 4 times, while once would suffice. So -1 for wasted CPU cycles. More
First-Andrew314
Good thinking to replace the zeros. More
First and simple-bajun01
I like the len(args) < 2, hadn't thought about that. The print statements are unnecessary, though. I also think iterating over args twice is a bit much. If a is not greater than max, check if it is smaller than min in the same iteration. Shouldn't make it any less clear. More
Second-ceu9jo
I like the use of the list. Seeing OPERATION_NAMES, made me think of something like this. Just couldn't get my head around it. But I wouldn't consider this a very _clear_ solution. I have to do some maths to see what's going on. Also, a space after a comma would have been nice for readability. More
dispatch dictionary with unreadable operations-Arandomusername
But this would perform all the boolean operations to populate the dictionary. Is that really so speedy? More
First-pytonio
This is a fantastic way of doing it. More
First-Borgoroth
Doesn't look very speedy to me. You do nothing with **OPERATION_NAMES**, so why create it? That's wasted CPU time right there. ;) Also the int() conversions are unnecessary, because *bool* is a subclass of **int**. More
1 2
3
4