40
suic
16 39 57
9964/ 10664
Last seen 4 days ago
Member for 9 years, 10 months, 19 days
Difficulty Advanced
Best reviews / Newest reviews
First-chronotable
Hi, do not redefine _sum()_: # This is shorter, nicer and faster f = sum(map(abs, groups)) # than: sum = reduce(lambda x, y : abs(x) + abs(y), groups) More
First-chronotable
Hi, do not redefine _sum()_ it is a useful built-in function. More
First-chronotable
Hi, 1. look at _any()_: def contain(s, need): return any(c in need for c in s) 2. look at _str.isupper()_, _str.islower()_, _str.isdigit()_. More
RE + Collections + Operator-sewpafly
Hi, you could write: text = "".join(filter(str.islower, text.lower())) More
Condition by condition we travel-jrebane 1
Hi, 1. you certainly heard about _any()_. 2. As Veky already told you: You can omit [] and _sum()_ the __bool__`s`. 3. etc. ... More
Tricky!-bbmin7b5
Hi, that last if is redundant: `return ''.join(result)`. More
tricky-bbmin7b5
Hi, lot of redundancy there 1. that `if...else` is redundant: return len(password) >= 10 and match and match1 and match2 2. Or lines 4-6 contains the same pattern. More
Even the last-schanjr
Hi, len(array) is redundant: array[::2] is the same. More
First-gunlinux 1
Hi, you can use `*` for unpacking, e. g.: datetime.datetime(*date1) More
Don't know which one is the best-NEED 2
Hi, nice :) Can you do it without `if` and `try...catch`. More
Simple and Clean-shui91
Clean? def checkio(array): return sum(array[::2]) * array[-1] if array else 0 More
First-sake12
Hi, why not: return bool(re.search(r'([a-zA-Z]+) ([a-zA-Z]+) ([a-zA-Z]+)', words)) More
Regex-sake12
Hi, that `regex` dictionary is redundant: regex = re.compile("[A-Z]") ... if regex.match(c): out += c In fact you don't need regex at all: return "".join(filter(str.isupper, text)) More
First-sake12
Hi, it would be faster and more memory efficient with _sum()_: count_words = lambda text, words: sum(w in text.lower() for w in words) More
First-LMAO
Hi, you don't need the [] on line 10. More
Digits Multiplication -schanjr
Good one! P. S.: You can omit the >= 1 at the end. More
First-Slepice1
Hi, with all() you could make it a one-liner. More
First-WpoZoo 1
Hi, one comment: I would replace lines 13-15 with one line: # You can apply map(int, ) directly on splitted_data # and use it as argument of date year, month, day = map(int, splited_data[0].split('-')) # In fact you can eliminate these these three variables call_data More
itemgetter-gyahun_dash
Hi, interesting. I didn't know about itemgetter(). More
First-Amachua
Hi, I would write: def total_cost(calls, allowed=100): ... More