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-MarcinSzpakiewicz
Hi, I have a few comments: 1. (a + b + c == len(password)) is redundant. 2. Once a, b and c are greater than 0 you can return: # so: ... if d in string.digits: c+= 1 if c > 0 and b > 0 and a > 0: return True return False 3. Instead of lines 4-6 you can write this: More
First-MarcinSzpakiewicz
Hi, I have three comments: 1. Don't use _sum_ as variable name. It's a built-in function. 2. Look at list comprehensions and generator expressions. 3. Look at _str.join_. Join and generator expression in action: return "".join(char for char in text if char.isupper()) More
First-MarcinSzpakiewicz
Hi, you can omit reverse=False. More
First-MarcinSzpakiewicz
Hi, you can unpack arguments with *, e. g.: datetime.date(*date2) More
House password-GinnyPennekamp 1
Hi, 1. if..else is redundant as you return your condition. 2. You can shorten you condition using generator expression and _all()_ or _any()_. More
Simple & clean, with recursion-AntoniGoldstein 1
Hi, this is little bit "re-inventing the wheel", look at _bin()_. More
First-l-vincent-l
Hi, you don't need _math.pow()_ there is the `**` operator. More
First-l-vincent-l
Hi, `[2:]` is redundant as the first two characters are `0b`, which won't change the `.count('1')`. More
First-l-vincent-l
Hi, in Py 2.7 you don't need the _str()_. More
First-l-vincent-l
Hi, in Python you can write it this way: 97 <= ord(c) <= 122 More
First-l-vincent-l
Hi, 1. Look at _str.endswith()_. 2. Look at `operator` module. 3. In this a _generator expression_ or list comprehension would be faster than _map()_ and IMHO cleaner: [x != y and len(x) > len(y) and x[-len(y):] == y for x, y in itertools.product(words_set, words_set)] More
First-l-vincent-l
Hi, look at _timedelta.days()_ method. More
First-l-vincent-l
Hi, look at _min()_ and _max()_ built-in functions. More
First-l-vincent-l
Hi, 1. _list()_ is redundant. 2. You could use `&` operator for set intersection. More
First-l-vincent-l
Hi, lambda is redudant. _abs()_ is a function: return sorted(numbers_array, key=abs) # pay attention that it is abs and not abs() More
First-neophobias
Hi, 1. You don't need the `result` variable. 2. Look at _all()_, e. g. you can write this instead of line 8: if all(j.isalpha() for j in wlist[i:i+3]): 3. You don't need that `else` branch. 4. Look at _any()_. Using it you can refactor lines 3 and 6-10 like this: return any(all(j.is More
First-neophobias
Hi, 1. all those inner `if...else`s are redundant, e. g.: return not (x == 1 and y == 0) # for lines 13-16 2. you don't have to enumerate the cases. Just use `or`, `and` and `not` built-ins and `==` and `!=` operators. More
First-neophobias
Hi, 1. `== True` is redundant as _str.isupper()_ returns __bool__. 2. __str__ is immutable, therefore it is not the best type for accumulation. 3. Last but not least __str__ is _iterable_ so you could write: for i in text: if i.isupper(): word += i # or even better More
First-marroyo
Hi, `message` is redundant: return "".join(i for i in text if i.isupper()) More
Boolean Algebra-marroyo
Hi, you don't need all those internal `if...else`s e. g.: if operation == "equivalence": return x == y More