44
gyahun_dash
13 34 48
14278/ 15612
Last seen 5 months ago
Member for 10 years, 3 months, 4 days
Difficulty Normal
Best reviews / Newest reviews
First-yoichi
n = int(radius) if radius > n: n += 1 **math.ceil** is helpful to you: n = ceil(radius) More
First-gyahun_dash
I've revised this with regular expression [here](http://www.checkio.org/mission/find-sequence/publications/gyahun_dash/python-3/research/). More
First-wervyn 1
In line 22, you can use **itertools.permutations** instead of your defined function: for p in permutations(len(words)): More
sorted fast-gyahun_dash
This is speed-up version of [sorted](http://www.checkio.org/mission/cipher-crossword/publications/gyahun_dash/python-3/sorted/). More
First-sshell
num = [] for i in str(number): num.append(int(i)) List comprehension is helpful to you. Let's try it. num = [int(i) for i in str(number)] More
First-djnet
You can use built-in functions, **max** and **min**. More
First-deadreact
bools = [True if len(re.findall('[a-zA-Z]+', x)) > 0 else False for x in words.split()] You can use **re.match** instead of **re.findall**: bools = [re.match('[a-zA-Z]+', x) is not None for x in words.split()] More
Xs and Os Referee-davivcgarcia 1
Does it work against following test case? checkio([ "XO.", "XO.", ".O."]) == "O" More
First-gyahun_dash
small, large = min(jars), max(jars) indices = [jars.index(j) + 1 for j in (small, large)] I should use **if-statement** once. if first <= second: small, large, indices = first, second, (1, 2) else: small, large, indices = second, first, (2, 1) More
Speedy DP-gyahun_dash
This is speed-up version of my [DP](http://www.checkio.org/mission/loading-cargo/publications/gyahun_dash/python-3/dp/). More
First-panther-king 1
lst = [list(x) for x in grille] for l in zip(*lst): You can unpack strings directly: for l in zip(*grille): More
First-netsamir
Interesting. I'll try a similar approach. Thank you! More
re.match-gyahun_dash
pats = 'PPP...... | ...PPP... | ......PPP' #: rows (blank=0) '..P.P.P..' #: diagonal (blank=1) 'P..P..P.. | .P..P..P. | ..P..P..P' #: columns (blank=2) 'P...P...P' #: diagonal (blank=3) # P = O or X More
Second-panther-king
It looks clearer than previous. Moreover, you can simplify your code more by using list comprehensions. For example: def iterate_grille(grill): iterated = [] for l in zip(*grill): iterated.append(''.join(reversed(l))) return iterated You can use i More
__-Cjkjvfnby
phrase = consonants_pattern.sub(r'\g<1>', phrase) return vowels_pattern.sub(r'\g<1>', phrase) You can use r'\1'. More
Newton with initial guess-gyahun_dash
# initial guess in [1, 10 ** 10] (slapdash approximation) in [1, 10] correctly. lognum = log10(number) to convert range from [1, 10 ** 10] to [0, 10] x = -0.05 * lognum ** 2 + 1.4 * lognum + 1 to approximate **lognum** to super root. More
Second-coells 1
Amazing! BTW, you can replace the expression in line 5 as follows (but not readable so much): r'(-?%s-?)'%(x) More
First-drgonzo132
"X{"+str(len(game_result))+"}|O{"+str(len(game_result))+"}" This pattern is equivalent to: "^X+$|^O+$" or "^(X+|O+)$" More
robot-sort --> s7even-s7even 1
tmp = l[i+1] l[i+1] = l[i] l[i] = tmp You can write them shortly: l[i], l[i+1] = l[i+1], l[i] More
First-gyahun_dash
Reversed version [here](http://www.checkio.org/mission/robot-sort/publications/gyahun_dash/python-3/third/). More
1 2
3
4 5