11
Peter.White
1 10 28
548/ 645
Last seen 3 years ago
Member for 9 years, 1 month, 17 days
Difficulty Normal
Best reviews / Newest reviews
o, safe pawns...-veky 7 1
How do you not get headaches when writing something like this? I get them just from _reading_ it. ;) More
First-gcampfield 2
\D > [Matches any character which is not a Unicode decimal digit.](https://docs.python.org/3/library/re.html) Not exactly what was asked for. Only the precondition saves you from unwanted results. :) More
First-Kerulen 2
If I have to scroll horizontally to read it, it is not clear. -1 for bad style. The approach I like. I used the same. More
Without import-Arandomusername 2 1
Not very speedy. You are iterating over the whole text, which by definition must be at least as long as the alphabet you are checking against. Iterating over the alphabet is the faster solution. And, of course return false immediatly, if text isn't even long enough. ;) Also, you are checking all le More
First-Slepice1 1
You can contract lines 3 and 4 to: return int(str_number,radix) More
First-spoty 1
I was thinking about using a dictionary, but being fairly new to the concept, I couldn't figure it out. Thanks for this great solution. More
First-kazuau 1
Your RE is a bit repetitious. if re.search(r'([a-z]+\s){2}[a-z]+', words, re.IGNORECASE): is shorter and somewhat clearer in my opinion. Anyway, I don't like throwing REs at everything, when there are simpler means available. **str.isalpha()** is a built-in method, so no need to **import re**. More
max-count-bryukh 1
What the...? ;) Just great. Wish I had thought of that. More
First-lukas.linhart 1 1
Nice approach. But it took me a while to grasp what's happening. I'd say that makes it a little less clear. ;) Oh, and line 19 should be the other way around: if state[0] != '.' and len(set(state)) == 1: # no point for set() if [0] is '.' But that's just a minor thing. More
First-veky 1 1
Lol, I also had the idea to use a dictionary and enumeration. But somehow it didn't cross my mind to just use enumerate directly, so I put it in a dict comprehension. Silly me. ;) Oh, the use of recursion is nice too. At one point I thought about it and then dismissed it after failing to find the r More
use timedelta object-fantakeshi 1 1
Could have just used the built-in abs() instead of importing fabs from math. ;) More
Straight Forward-makernaren 1 1
Oh dear! There is not a single iteration in there. I hope your fingers hurt after typing that. ;) More
Second-noobien 1
I don't think, this is particularly speedy. **text.lower()** is called for every letter in the alphabet. Once, outside the loop, would have sufficed. More
Clear-denisbalyko 1
I like the **union** idea. But your list is waste of space, when there are duplicate connections in the initialization, like {"a", "b"} and {"b", "a"}. You could have made that list into a **set** of **frozensets**. Reusing the names() method is nice, though. I had forgotten to think about that. ;) More
BFS-Kwentar 1
Line 6: __range(len(names_of_rel))__ would be more flexible, in case someone decided to put multi-level connections in __network__. ;) Lines 7 through 11: You use __names_of_rel[i]__ _four times_ and __names_of_rel[1-i]__ twice. Those are list operations, which cost time, but the values don't chang More
str & int-furas
You could do if digit: result *= digit one lines 9 and 10; more concise that way. Do away with line 5 and instead on line 7 for str_digit in str(number) no point in creating a variable if it's only used once. ;) More
First-rozbudowywowywacz
The int conversion is not necessary, because bools are also ints. Also, you could have broken up line 1 into multiple lines. This is not very readable. 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
dictionary-pi314
Clever trick with the [o[:2]] there. ;) But this also has to create all the dictionary elements, and for that, all the boolean operation for the values need to be performed. 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