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-AlekseyDemidov
Hi, 1. Don't use _sum_ as variable name it is a built-in function. 2. Look at _list comprehensions/generator expressions_ and _str.join()_. More
First-AlekseyDemidov
Hi, you could write: return ",".join(phrases).replace("right","left") More
First, using sorted()-sk7
Hi, 1. You can omit []. 2. Look at _filter()_. More
Single line checker-jrebane
Hi, look at _all()_ and _generator expressions_: return all(x in text.lower() for x in ascii_lowercase) More
First-sk7
Hi, 1. Look at _sum()_. 2. You could write `range(len(sequence) - 1)` More
First-chronotable
Hi, 1. Look at _fractions.gcd()_ and 2. _functools.reduce()_. More
First-chronotable
Hi, you could write `ret += 1`. More
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
First-Drazzil
Hi, you don't need all those nested `if`s e. g.: elif (operation == OPERATION_NAMES[4]): return x == y More
First-Drazzil
Hi, look at _str.replace()_ and _str.join()_. More
First-Drazzil
Hi, () around conditions are redundant. More
First-Drazzil
Hi, 1. look at _extended slices_: `array[::2]` 2. and do not redefine _sum()_ built-in function: `sum(array[::2])` More
First-Drazzil
Hi, look at _reduce()_, _map()_, _filter()_ and _int.\_\_mul\_\_()_ or at _operator.mul()_. # you can write this: def checkio(number): return calculation(int(x) for x in str(number)) # then: from functools import reduce def checkio(number): return re More
First-Drazzil
Hi, look at _filter()_ and _str.join()_: return "".join(filter(str.isupper, text)) More
First-Drazzil
Hi, look at _sum()_ and generator expressions: return sum(word in text for word in words) More
Inelegant, but it works.-lukewrites
Hi, I think you know that `is not` is not the right comparison here. More