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-ZeLib0ba
Hi, you could write _fibo_check_ like this: def fibo_check(numb): return numb in fibonacii(numb + 1) 1. The _if_ is redundant as numb in ch is already a boolean. 2. ch don't have to be a list as you could iterate over generator. 3. As you use _ch_ only once you could easily eliminate More
mass-Lumiera
Hi, I have two comments: 1. I hope, you've just forgot to remove the semicolon on line 3 :) 2. Look at _sum_ built-in function e. g.: # Lines 5-8 you could replace with: k = sum(array[::2]) # or the whole else block: return sum(array[::2]) * array[-1] # That's it :) More
Проверка паролей-Lumiera
Hi, I have two comments: 1. In fact you don't need the else branch on line 11: if len(data) < 10: return False # unindent the rest by one level. 2. On lines 4-9 you have three time the same pattern. You can extract the pattern and eliminate repetition. You have: if re. More
First-Screw 1
Hi, on thing: _lambda_ and _map_ are redundant: # You can join the phrases first which will result in one big string. s = ','.join(phrases) # And as s is a string you can directly call its replace method. return s.replace('right', 'left') # Finally: As you can chain More
First-jonmosco 1
Hi, line 5 is useless as on the next line you assign a different value to _new_. In fact you can eliminate _new_ completely i. e. replace _new_ with _phrases_ on line 7. More
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