40
suic
16 39 57
9966/ 10664
Last seen 22 hours ago
Member for 9 years, 11 months, 3 days
Difficulty Advanced
Best reviews / Newest reviews
Drunk lisper =\-Columpio 1
Hi, one thing: _iter_ is a built-in so it shouldn't be used as a variable name. More
Funny --> functools-dronnix 1
Hi, you can use int.\_\_add\_\_ instead of lambda or you can: import operator return functools.reduce(operator.add, data) but in fact _all you need is __sum___. :) More
First-haitai
Hi, 1. You don't need the last if...else. 2. dight, upper, lower are booleans so why not: return all((dight, upper, lower)) 3. You don't _re_. Look at _str.isupper_, _str.islower_ and _str.isdigit_. More
First-KRThunder
Hi, all if...else are redundant. You can directly return conditions or their negations. More
First-KRThunder
Hi, if you've chosen _str.find_ intentionally, then it's an interesting creative solution. More
My solution-Davey1973
Hi, a few things (maybe I could add them to the forum thread :/): 1. _else: pass_ is redundant, if branch is enough. 2. You can omit the _x_ variable and use _data_ i. e. for i in data: ... 3. When you'll more comfortable with Python you can implement it in fancier way using _list More
First-tilikum
Hi, 1. == True is redundant. 2. List comprehension/generator expression or filter would be better here: return "".join(lett for lett in text if lett.isupper()) # or: return "".join(filter(str.isupper, text)) More
First-ph63
Hi, one of the list typical solution. Next challenge: Make it completely _if-free_ :) More
First-ph63
Hi, you don't list on line 3. __str__ is iterable. More
First-tofguerrier
Hi, I see that this is an older solution, but let me have comments: 1. You don't the _all_ variable, so line 4 is redundant. 2. Instead of assigning: le = len(data) >= 10 # You should immediately return: if len(date) < 10: return False # when the password is to short is unn More
First-Imelda 1
Hi, you have three time the same pattern in your code, try to look at _all()_ or _any()_. More
First-jjwink19 1
Hi, I have two comments: 1. Don't use "sum" as a variable name. This way you overrides a useful built-in function called [sum](https://docs.python.org/3/library/functions.html#sum). 2. _sum_ in action: return sum(array[::2]) * array[-1] # and that's it # and now you can remove lines More
First-jjwink19 1
Hi, it's straightforward and easy to understand approach, but not quite pythonic. There are [built-in functions](https://docs.python.org/3/library/functions.html) like max() and min(), so you can replace lines 6-11 with: return max(args) - min(args) More
First-evoynov 1
Hi, can write line 4 like this: for w in words: cnt += bool(text.lower().count(w)) More
First-vbereznyuk 1 1
Hi, when you first join the phrases, you can replace the words all at once: return ",".join(phrases).replace('right', 'left') More
First-vbereznyuk 1
Hi, as you don't use the index here: for index, value_b in enumerate(sequence[index:]): # you can write: for _, value_b in enumerate(sequence[index:]): More
First-vbereznyuk 1 1
Hi, # Instead of this: if len(queue) == 0: continue queue.pop(0) # you could write this: if queue: queue.pop(0) More
First-vbereznyuk
Hi, you could write: int.__mul__ # instead of: lambda x, y: x * y More
First-kstep
Hi, look at _str.isupper_, _str.islower_ and _str.isdigit_: any(c.isupper() for c in data) # instead of: any(c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' for c in data) etc. More
First-kstep
Hi, look at slice in Python: # You could write: sum(array[::2]) # instead of: sum(array[n] for n in range(0, len(array), 2)) More