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
I spend way too much time on this...-Ceph3 1
... two thumbs, but those [] on line 59 are redundant :) More
regex and sets-SubramanyamS
Hi, on line 8, 9 the right-hand sides differs in one number. E. g.: even, odd = ({c for i,c in enumerate(word.upper()) if i%2==x} for x in (0, 1)) More
Map and Filter-SubramanyamS
Hi, list(filter(...)) and that _dictionary comprehension_ on line 10 are a bit overkill. It can be done with a one-line long _list comprehension_. More
A sort-of functional approach-matyas.kuti
Hi, its a bit "agyonfunkcionalt" :): 1. All the lambdas are redundant as in a) Python functions are first class citizens and b) you can use the methods of built-in types directly. 2. In this case any_with_pred is also redundant. def checkio(data): predicates = [str.isdigit, str.islowe More
First-py_code 1
Hi [] are redundant. You can write: return sum(c in txt.lower() for c in words) More
First-py_code 1
Hi, the () around ','.join(phrases) are redundant. More
using recursion-gtuk
Hi, this is not pythonic. Look at _str.join()_ method. More
First-cool_cool
Hi, `num` and `val` are redundant: return array[n] ** n More
First-cool_cool
Hi, `list1` and `str1` are redundant: return ''.join(re.findall('[A-Z]*', text)) More
First-mecatxis
Hi, 1. `&` means [_set intersection_](https://docs.python.org/3.4/library/stdtypes.html#set.intersection) in Python. Use `and` instead. 2. You could move line 10 inside the for loop and return the condition: return number and lower and upper More
First-anonymorf
Hi `x` is redundant: return "".join(findall('[A-Z]', text)) P. S.: You can solve it without using __re__. More
First-YoannD
Hi, this is the same: return firstWLcCounterList == secondWLcCounterList is the same as: if firstWLcCounterList == secondWLcCounterList: return True else: return False More
First-Jeroen12344
Hi, 1. `number/x == int(number/x)` ... ugh. Use `%` instead. Have a look at [this](https://docs.python.org/3.4/library/stdtypes.html#numeric-types-int-float-complex). 2. Line 16: `if not len(outputString):` 3. Have a look at other solution, this one is quite "overengineered" More
First-Jeroen12344
Hi, have a look at _sum()_ and _extended slices_. for w in range(0,len(array),2): total += array[w] # is the same as: sum(array[::2]) More
First-Jeroen12344
Hi, `in` in Python is quite powerful: if searchTerm in text: wordsFound += 1 # or even: wordsFound += searchTerm in text # or even shorter: return sum(searchTerm in text for searchTerm in words) More
First-Jeroen12344
Hi, `enumerate` is redundant: for c in text: ... You could use _filter()_ instead. More
First-dasich12
Hi, few things: ad Line 2: a = sorted(((x, abs(x)) for x in numbers_array), reverse=True) But you actually don't need `a` and logic on line : return sorted(numbers_array, key=abs) More
First-artemoniux
Hi, 1. _bin()_ returns a __str__ therefore line 3 is redundant. 2. `b` is redundant. You can chain methods in Python. return bin(number).count('1') More
First-artemoniux
Hi, 1. there's a shorthand syntax for `R = R + 1` -> `R += 1`. 2. You could use _generator expression_ and _sum()_. text = text.lower() return sum(word in text for word in words) More
First-artemoniux
Hi, 1. _str.isupper()_ return __bool__, therefore ` == True` on line 4 is redundant. 2. `text` is __str__, which is iterable: for word in text: # This is if word.isupper(): # a filter :) S += w return S 3. You could use _filter()_ and _str.join()_: r More