40
suic
16 39 57
9966/ 10664
Last seen 1 day ago
Member for 9 years, 11 months, 4 days
Difficulty Advanced
Best reviews / Newest reviews
First-leifive
Hi, if...else is redundant: return len(set(filter(str.isalpha, text.lower()))) == 26 More
Second-Qandak
Hi, you avoid if...else: return len(args) and max(args) - min(args) More
First-Qandak 1
Hi, you don't the last if...else: return i >= 3 More
First-Qandak
Hi, you can avoid the else if :) return len(array) and return array[-1]*sum(array[::2]) More
First-Qandak
Hi, you can unpack the _date1_ and _date2_ tuples with *. d1 = date(*date1) d2 = date(*date2) More
First-Qandak
Hi, there's an alternative approach. _str.join()_ first and then use _str.replace()_. More
First-Qandak
Hi, you don't need to sort the words => _sorted()_ is redundant. You can use a more functional approach: return sum(x in text.lower() for x in words) More
First-Qandak 1
Hi, lambda is redundant, key=abs is enough. More
House_password-Dayo
Hi, this is reinventing the wheel. Look at _str.islower()_, _str.isupper()_, _str.isdigit()_. More
generator expr. and join-Peter.White 1
Hi, why generator expression? When you first join, then you can use _str.replace()_. More
timedelta-Peter.White
Hi, with unpacking "*" it would be much shorter. More
Oneliner-psystyle 1
Hi, _bin()_ return __str__ and it has __str.count()_ method, try to apply it on this case. More
First-ankurjuneja
Hi, and now you can remove line 12 and lines 1-3 :) More
Verify anagrams - First-erik.white.2014
Hi, list()s are redundant. __str__ is iterable. More
First-todogzm
Hi, extract the pattern from line 4, 5 and make it a function: f = lambda w: collections.Counter(w.replace(' ', '').lower()) return f(first_word) == f(second_word) More
First-yubitani
Hi, fwx and swx are redundant. f = lambda w: Counter(w.replace(' ','').lower()) return f(first_word) == f(second_word) More
First-log2av
Hi, don't use "\\" if it's not necessary. Put your expression in () instead e. g.: grid = ([tuple([0]) * (len(grid[0]) + 2)] + [tuple([0]) + i + tuple([0]) for i in grid] + [tuple([0]) * (len(grid[0]) + 2)]) There are redundant [] on the last line: return sum( More
First-log2av
Hi, 1. The last if is redundant and the == True tests are redundant. return value1 and value2 and value3 and value4 # or return all((value1, value2, value3, value4)) 2. If the len(data) < 10 then it does not make sense to compute the rest, it's better to return immediately. More
First-OlegKulik 1
Hi, _str()_ is redundant. _bin()_ returns __str__. More
First-jgo3000 1
Hi, the last if is redundant: return lengthCheck and digitCheck and upperCheck and lowerCheck In fact, all the if's are redundant, but I don't want to go so far :) More