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-Fettn
You can omit the _list_ here: any(list(map(lambda x: x.isdigit(), data))) as _map_ returns an iterable which _any_ can consume. This pattern: any(list(map(lambda x: x..., data))) is there three times. You can replace it with _all_ and list comprehension/generator expression. More
First-akabos
Lines 10-12 == re-inventing the wheel (check str.isdigit, str.islower, str.isupper) More
First-roman.maksymiv
Why not?: def exclusive(x, y): return not(x == y) def equivalence: return x == y def implication: y if x else 1 More
First-vak123
Hi, this is two times the same code as you perform the same set of operation on _first_ and _second_. A few suggestions: 1. You can use sorted(x) instead of x = list(x); x.sort(): x = sorted(x.lower()) 2. You can avoid the redundancy mentioned above with a separate (or even nested) _ More
First-vak123
fib += [age] is the same as fib.append(age) More
First-vak123
A _for_ loop would be a better solution for lines 5-10 e. g.: for rep in (('IIII', 'IV'), ('VIV', 'IX')...): large = large.replace(*rep) __*__ before _rep_ unpacks the tuple. More
One-liner-suic
Thanks. Today I would do it differently. :) More
Complicated a bit-OlegDurandin
Hi, I have two things: 1. Use str.join instead of resString + for loop (in this case ",".join()) 2. list() is redundant on line 3 sorted() can consume sets. More
Simple solution in thee strings-OlegDurandin
Hi, two things: 1. list() is redundant as sorted can consume str. 2. lines 2 and 3 contains the same pattern, you could make it function or lambda function. More
First-Elrengil
You can write: if all(i.isalpha() for i in words[w:w+3]): instead of: if words[w].isalpha() and words[w+1].isalpha() and words[w+2].isalpha(): More
First-Riddick
Hi, there are some things you can omit: 1. str.split returns a list so: lst = words.split() 2. I don't see the point of this: if type(lst[0]) == str: count = 1 # In fact you can omit the whole if and modify the for in a way described in no 3. 3. a) You can/should ite More
First-randers 1
Hi, this: return count >= 3 # or this return not count < 3 is the same as: if count < 3: return False else: return True More
First-AlexanderKrivenko 1
Hi, line 13 is pointless: return l More
First-metallidog
Hi, you can write line 2-4 on one line, because: 1. time.split(":") returns a list which is iterable 2. lines 3 and 4 contains the same pattern i. e. apply the same function on the list items, which is what __map__ does. specs = map(int, time.split(":")) # you can also write list com More
First-Taca
Hi, it's written in little bit "schizophrenic style" I mean the for cycle with an if at the and. Why not?: return not any(i + j for i, j in zip(vector, vectorT)) More
kp25-kp25
Look at str.isdigit, str.islower and str.isupper. More
First-gaozhefeng 1
Hi, flag variable, the break and the !=0 are redundant: if matrix[i][j] + matrix[j][i]: return False More
Second-droonkid 1
I like this check: if matrix[x][y]+matrix[y][x]!=0: but this I would like even more: if matrix[x][y]+matrix[y][x]: More
First-zamuka
Hi, you don't need those ugly backslashes. In parentheses you can have line breaks. More
First-zamuka
Hi, you can nest _generator expression_ and use _any()_: return any(any(cw.endswith(word) for cw in words_set if len(cw)>len(word)) for word in words_set) More