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-AlexanderKrivenko 1
Hi, 1. You don't use `string` so that import is useless. 2. The last if redundant: return (len(data)>=10) and (pD is not None) and (pCha is not None) and (pChA is not None) 3. All the `is not None` statements are redundant. 4. You can use _all()_ instead of chained `and`s: return all((l More
any(filter())-otonvm
Hi, it's kinda repetitive. Look at _all()_ and _generator expressions_. More
Regexp approach-rugala
Hi, cool! :) But: 1. That _bool()_ is redundant (look at [this](https://docs.python.org/3.4/library/stdtypes.html#truth-value-testing)). 2. Look at _all()_: return all(re.compile(r).search(data) for r in [r'\d', r'[a-z]', r'[A-Z]']) # or even: return len(data) >= 10 and all(re. More
not in lower()-otonvm
Hi, look at _all()_ and _any()_. More
sorted abs-otonvm
Hi, __tuple__ is iterable, therefor _list()_ is redundant. More
One-liner-otonvm
Hi, when you first join and then replace, you can do all the replacements at once: return ",".join(phrases).replace("right", "left") More
:D I really wanted one-liner-Lasica
You gave up to early. There's a way to make it a one-line with lambda and \_\_import\_\_ :) More
First-Mycroft0121
You don't need the _a_ variable. Why not just: return zip(*data) ? More
Straightforward-CryteLynn
Hi, let me have some comments: char.islower() is the same as: char.lower() == char char.isupper() is the same as: char.upper() == char use these two and you can omit the: for char in data: if char.isalpha: ... char.isdigit() is the More
ifLoop-donBit 1
In my opinion this is for two thumbs downs (You're lucky I can't do it as thumbs can't be negative :)) Here my explanation of thumbs downs: This is redundant: common = [] for word in set1: if word in set2: common.append(word) Set intersection is the right way in t More
First-Tarty 1
_toString()_ looks a bit "javaish" :) Just one thing. Why not: tmp = [int(''.join(toString(f))) for f in list(factors)] instead of: tmp = [] for f in list(factors): tmp.append(int(''.join(toString(f)))) ? More
must learn one-line looping-Jess-Nielsen
So, you want to learn [list comprehensions](https://docs.python.org/3/howto/functional.html?highlight=comprehension#generator-expressions-and-list-comprehensions)? :) This mission is an ideal candidate for it. More
First-P1O1E
Hi, try to look at help(str) or [this](https://docs.python.org/3/library/stdtypes.html?highlight=str#string-methods). newphrase ="" for word in words: newphrase = newphrase + "," + word newphrase = newphrase.lstrip(",") equals to: newphrase = ",".join(words) More
First-Diegus
Hi, `median_...` variables are redundant, you could write e. g.: return (data[len(data)/2] + data[len(data)/2-1]) / 2.0 More
First-Diegus
Hi, 1. look at `list comprehensions`. 2. `counter` is redundant: if data.count(element) > 1: ... More
First-Diegus
Hi, that `if` is redundant: return nnn_str1 == nnn_str2 There's fair amount of duplication in your code: def helper(s): return sorted(s.lower().replace(" ", "")) def checkio(str1, str2): return helper(str1) == helper(str2) More
First-SmoUK
Hi, you could write: # empty array as treated as false: if not array: return 0 # total is redundant: return sum(array[::2]) * array[-1] More
First-SmoUK
Hi, don't use __str__ for accumulating values. It's immutable. More
First-SmoUK
Hi, that `== True` is redundant: if sub in text.lower(): total += 1 Tip: Look at _sum()_ and _generator expressions_. More
Even the last (Easy)-CodeHead
Hi, look at slices: `array[::2]` gives you the even elements. More