40
Last seen 4 days ago
Member for 9 years, 10 months, 19 days
Difficulty Advanced
Hi,
`if x == '0': continue` is redundant. Why not:
if not x == '0':
count *= int(x)
More
Hi, this is "obfuscative". Why not:
return [d for d in data if data.count(d) > 1] # ?
More
Hi, instead of lines 14-17 you could write:
return brackets == []
# or
return not brackets
More
You like typing :)
import re
VOWELS = "[AEIOUY]"
CONSONANTS = "[BCDFGHJKLMNPQRSTVWXZ]"
r = re.compile(r'\A({0}?({1}{0})*{1}?){2}\Z'.format(VOWELS, CONSONANTS, '{1}'), re.I)
def checkio(text):
return sum(bool(len(w) > 1 and r.match(w)) for w in re.split(r'
More
Hi,
1. You can import string.ascii_lowercase instead of `abc`.
2. `... if ... else ...` is redundant.
return all(w.lower() in text.lower() for w in abc)
More
Hi,
1. Default value for lst is useless.
2. You could omit parentheses around lst.count(x)>1 and out_list.
More
Hi,
1. print(result) is unnecessary as it's never reached.
2. you could use i += 1 instead of i = i + 1.
More
Hi, non_unique_data is unnecessary you could directly return the list comprehension.
More
Hi, this is all but not pythonic.
1. List is iterable. You don't need to use indexes to access elements.
2. Look at [enumerate](https://docs.python.org/3/library/functions.html#enumerate):
def checkio(data):
answer = []
for i, vi in enumerate(data):
for j, vj i
More
Hi, len(text) == 26 is a boolean so you can return it directly without if:
return len(text) == 26
More
Hi, I agree with previous comment, but you can also significantly shorten you existing code e. g.:
# assign game_result to a shorter variable
gr = game_result
# remove all the _row, _column, _diag variables as you don't need them (see below),
# replace game_result with gr and crea
More
Hi, "crystal clear" but creative :)
1. `map(lambda x:...)` is not good practice.
2. Alternative way to compute signum: `def signum(x): return (x > 0) - (x < 0)`
More
Hi, this is not pythonic:
1. `from math import *` ugh!!! Import everything from `math` for a function which you don't need... is the reason for thumbs down.
2. Look at `//`.
3. `if not data:` instead of `if len(data) == 0:`
4 `else` branch on lines 11-17 is redundant:
def checkio(data):
More
Hi, you have weird sense of clear. This solution is not pythonic, e. g.:
1. Import `string` is redundant.
2. __str__ has _str.islower()_, _str.isupper()_ and _str.isdigit()_ methods.
etc.
More
Hi, look at [__collections.Counter__](https://docs.python.org/3.5/library/collections.html?highlight=counter#collections.Counter).
More