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
2-firexd2 1
```python def index_power(array, n): if len(array) > n: return array[n] ** n return -1 ``` More super? :) More
First-xivanity
Hi, interesting approach :) Below is a slightly refactored version. I'm too lazy to give a detailed description so I highlight only two things: 1. Check [this page](https://wiki.python.org/moin/TimeComplexity). 2. There's no need to store a list of lists in `li` as you only need its length. Regard More
Digits Multiplication-G_I_B_B_O_N 1
Hi, You can replace lines 1-6 with: numbers = map(int, str(number).replace('0', '')) Regards, suic More
sum(list comp) * last-anter69 1
Hi, gondolom ma mar igy irnad: `sum(array[::2])` :) Regards, suic P. S.: A codewarsbol komolyan elegem lett. Februar ota nem jatszom. Ami a [kerdesedet](https://www.codewars.com/kata/57b971f68f58135e840001cc/discuss#58ff5dc2588521f39c00003d) illeti: Szerintem [ez](https://hu.wikipedia.org/wiki/B More
Absolute sorting - lambda sorting key-evca.mayerova 1
Hi, `lambda` is redundant. `key=abs` is enough. Regards, suic More
GroupBy-frantisek.jahoda 1
Hi, you can avoid constructing the list just for checking its length buy replacing `len(list(g))` with this sum(1 for _ in g) As I remember, @veky gave me this advice long time ago. Regards, suic More
All the Same (Second) -c135260
Alternative: ```python return not bool(elements) or len(set(elements)) == 1 ``` Regards, suic More
quite speed-lsk45 1
Hi, that if is redundant: return eval(OPERATION_NAMES[operation]) # or even: boolean = lambda x, y, op: eval(OPERATION_NAMES[op]) More
Readable-tinytao
Hi, too many comments don't make code readable. Regards, suic More
First-davidhqu
Hi, in normally when you have an `if ...: pass` or `else ...: pass` branch then there's something wrong with your code: ```python def correct_sentence(sent): if not sent[0].isupper(): sent = sent[0].upper() + sent[1:] if sent[-1] != ".": sent = sent + "." return(sent) ` More
map-androidbigold 1
Hi, you've actually implemented [`filter`](https://docs.python.org/3/library/functions.html#filter) with `map`. It's a nice misuse :) ```python def find_message(text): return ''.join(filter(str.isupper, text) ``` Regards, suic More
First-tigerhu3180 1
Hi, `lambda` is redundant as `abs` is a function (so `key=abs` is enough). Regards, suic More
sort and subset-stefpiatek
Hi, sorted data is redundant. `sorted()` returns a list which you slice. Regards, suic ```python return sorted(data, key=lambda x: x['price'], reverse=True)[:limit] ``` More
sum of list comprehension one-liner-pseudorandomcoder 1
Hi, you don't need the list comprehension: ```python sum(word in text.lower() for word in words) ``` Regards, suic More
First-kikichen
Hi, this code is quite verbose and not very pythonic. Check the official [documentation](https://docs.python.org/) especially 1. [Truth Value Testing](https://docs.python.org/3/library/stdtypes.html#truth-value-testing) and 2. [Boolean Operation](https://docs.python.org/3/library/stdtypes.html#boo More
sorted One Liner with lambda expression-pseudorandomcoder 1
Hi, `lambda` is redundant as `abs()` is taking one argument and functions are first class citizens in python: `return sorted(numbers_array, key=abs)`. Regards, suic More
First-hilokazu.yoshino
Hi, ```python text = text.split(' ') # This splits the string by spaces. text[0] = text[0].capitalize() # can be replaced with text[0].upper() text = (' ').join(text) # the first paren in redundant if text[-1] != '.': # not pythonic. There's the str.endswith More
First-MASIAIN
Hi, ```python if not text.endswith("."): text += "." ``` Regards, suic More
Clean and simple.-Celshade 1
Hi, interesting approach. The 0 on line three is redundant. Regards, suic More
operator.itemgetter-jbwb 1
Hi, you could use `sorted()` instead of `list.sort`: ```python return sorted(data, key=itemgetter('price', 'name'), reverse=True)[:limit] ``` Regards, suic More