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-mariacl 1
Hi, you can shorten your code like this: def checkio(data): data.sort() length = len(data) if length%2 == 0: return (data[int((length/2)-1)] + data[int(length/2)])/2 else: return data[int((length-1)/2)] More
First-metallidog 1 1
Hi, the lambda superfluous. In this case you could write: return sorted(number_array, cmp=abs) More
First-cle99y 1 1
It's impressive :) Some tips how to make it more "pythonic" (hopefully they'll be useful): 1. Check [PEP8](https://www.python.org/dev/peps/pep-0008/). 2. In python two empty lines are used instead of #-------------------- 3. Make [docstrings](https://www.python.org/dev/peps/pep-0257/) from comments More
Clear(ness) xD solution! xD =D-ermichin158 1 1
Hi, in Python you can write this: a, b, c = args More
no fuss-PyPoet 1
Hi, I've mentioned it in one of my previous comments: You don't need `lambda` in these cases: return sorted(numbers_array, key=abs) # That's it :) More
6 three_words-illion 1 1
Hi, that last `if` is redundant: return count >= 3 More
brute-iken 1
Hi, the if...else is redundant. More
2 Index Power-illion 1
Hi, 1. Lines 1, 2 and 10 are pointless. 2. You could write `return array[n] ** n` and `return -1`. More
First-Peter.White 1
Hi, instead of lines 2, 4-6 you can write this: return sum(word in ltext for word in words) More
isupper-Peter.White 1 1
Hi, consider the fact, that __str__ is immutable in Python. And look at _filter()_ function or _list comprehensions_/_generator expressions_. # E. g.: return "".join(filter(str.isupper, text)) # That's it :) More
4 Monkey Typing -illion 1 1
Hi, what about: return sum(any(word in text_item for text_item in text.lower().split()) for word in words) More
filter-veky 1 1
After I've read a few long threads under your solutions I have to say, that _lambdaphobia_ is a common phenomenon on CiO :) More
3 words-juancruz.acosta2 1 1
Hi, a better way to solve it is to use str.isalpha. To your solution: 1. This is unnecessary: n = "0 1 2 3 4 5 6 7 8 9" n = n.split() # because str is iterable you can use this instead n = "0123456789" 2. You can chain methods: # so you can write word.lowe More
Most Numbers-mbabkin 1
Hi, instead of: if len(args) == 0: ... you could write: if not args: ... More
Anagrams-eB_s3000 1 1
Hi, 1. the last if is redundant: return sorted(some2) == sorted(some1) 2. You do same things twice (once for first_word and once for second_word). More
First-capybara23 1
Hi, 1. ";" is unnecessary. 2. Do not reinvent the wheel: Look at [_str.join()_](https://docs.python.org/3.4/library/stdtypes.html#str.join). More
Actual bit manipulation-pvdwijdeven 1 1
Hi, let's have a look at your `get_bin` function: ```python def get_bin(number): return (list(map(int, list(str(bin(number))[2:])))) ``` 1. `bin()` returns a __`str`__ => __`str`__ is redundant. 2. __`str`__ is iterable => `list` is redundant. ```python def get_bin(number): return list(map More
First-frantisek.jahoda 1
Hi, why not?: return sum(date(year, m+1, 13).weekday() == 4 for m in range(12)) More
while_robot-spoty 1
Hi, you can omit if r else "" as "".join([]) is "". :) More
cmp-capybara23 1
Hi, 1. Last if is redundant: return cmp(w1, w2) == 0 # or even: return not cmp(w1, w2) 2. __str__ is iterable, so you dont' list lines 6, 8. 3. You do same things twice (once for w1 and once for w2). 4. You can use _sorted()_ instead of .sort(). P. S. Thanks for inspiration. Resul More