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-hanpari 1 1
Hi, why not _filter()_?: "".join(filter(str.isupper, message)) More
Slightly Refined-AaronCritchley 1 1
Hi, Empty array is treated as false, so you can write: if not array: return 0 And also: array[0::2] == array[::2] so you can omit the 0. More
First-metallidog 1 1
Hi, the lambda superfluous. In this case you could write: return sorted(number_array, cmp=abs) More
Biiiiiiiiiig if-JanKaifer 1
Hi, why not: return (game_result[0][0]==who and ...) That `if...else` is redundant. 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
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
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
Second-lukas.linhart 1 1
This could be a nice one-liner :) 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
Cheater-JanKaifer 1
Hi, that `if` is redundant: return (pattern, command) in [(42,"12a0b3e4"), ...] More
Hacker-JanKaifer 1 1
Hi, use dictionary for this type of cheating :) 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
First-JohnScira 1
Hi, 1. You don't need == 1 checks 2. You can replace == 0 with _not_. More
First-JohnScira 1
Hi, 1. You don't need == True as _str.isupper()_ return True 2. Look at _str.join()_ and _generator expressions_: return "".join(i for i in text if i.isuppper) # filter is even better for this: return "".join(filter(str.isupper, text)) 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
First-spoty 1 1
Hi, 3 little things: # connection = (connection, ) is redundant self.connections += (connection, ) # lambda in line 23 is redundant: return reduce(set.union, self.connections) # change self.connection to list as self.connection is mutable e. g.: self.connections More
First-d1skort 1
Hi, 1. the last `if...else` is redundant. You could return your condition after some changes. 2. Those `== False` tests are redundant. More
First-Rita 1 1
Hi, 1. Instead of `t == t.upper()` you could use `t.isupper()` With _str.isupper()_ you can omit the `t.isalpha()` check. 2. `t` is already __str__ so _str()_ on lines 4 and 5 is redundant. result += t 3. Look at _filter()_ built-in. 4. __str__ is immutable type, therefore is not the best jo More
First-nastyajeid 1 1
Hi, _str()_ is redundant as _bin()_ returns __str__. More