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-hiya-m 1 1
Hi, you can use `str.__contains__`: return len(filter(text.lower().__contains__, words)) # or sum() return sum(w in text.lower() for w in words) More
First-hiya-m 1 1
Hi, that `lambda` is redundant: return reduce(int.__mul__, map(int, str(number).replace("0", "1"))) More
Secret Message-inga.s 1
Hi, look at _list comprehensions_ e. g.: message = [x for x in text if x.isupper()] # or the filter() built-in function message = filter(str.isupper, text) More
The hard way.-CraigFranklin 1 1
Hi, this is "overparenthesized" :D # E. g.: bin_n = bin(n)[2::][::-1] bin_m = bin(m)[2::][::-1] + diff_len * "0" More
First-hiya-m 1 1
Hi, 1. there's also 'str.isalnum()`. 2. I would move the len(data) < 10 to the beginning, once data is to short, you don't need to make the rest of the checks. 3. `bool` is redundant and it's not a good variable name as it's a name for a built-in type. More
Simple solution-psystyle 1 1
Hi, that if is redundant: return sorted(first_word.lower()) != sorted(second_word.lower()) More
First-psystyle 1 1
Hi, [] is redundant. _filter()_ built-in would be better here: return ''.join(filter(str.isupper, text)) More
First-CraigFranklin 1
Hi, you don't need _alph_: for i in string.ascii_lowercase: ... More
First-CraigFranklin 1
Hi, parentheses around bin(number) are redundant. More
First-CraigFranklin 1
Hi, look at documentation for _sorted()_. Sorted has _key_ argument, which is quite useful. More
The Most Numbers-inga.s 1
Hi, 1. `a`, `b` and `result` are redundant: `return max(args) - min(args)` is enough. 2. Same with lenght: `if len(args) == 0:` More
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
Digits Multiplication-inga.s 1
Hi, `1` is the _neutral element of multiplication_ lines 8 and 9 are redundant (`total * 1 == total`). You could use the _reduce()_ built-in function for this. More
Three words-theParasite 1
Checking if string is digit by trowing ValueError... Why? Have you heard about str.isdigit()? (check help(str.isdigit)) More
First-pushpam 1 1
Hi, you can omit the else and dedent (or outdent?) lines 7-14. More
First-marko_anton 1
Hi, 1. `myarr` is redundant. 2. _sorted()_ works with __set__. 3. There is the `&` operator for _set intersection_. def checkio(fst, sec): return ','.join(sorted(set(fst.split(',')) & set(sec.split(',')))) # or even: checkio = lambda fst, sec: ','.join(sorted(set(fst.split(' More
First-inga.s 1
Hi, look at [bitwise exclusive or operator](https://docs.python.org/3.5/library/stdtypes.html?highlight=str.count#bitwise-operations-on-integer-types) in Python (`^`). More
A lot of cycles...-ermichin158 1 1
Hi, `listToString` is reinventing the wheel. Look at [_str.join_](https://docs.python.org/3.5/library/stdtypes.html?highlight=str.join#str.join). More
set, list, index-Alexona 1
Hi, look at 1. [__collections.Counter__](https://docs.python.org/3.5/library/collections.html?highlight=counter#collections.Counter). 2. the [_filter()_](https://docs.python.org/3.5/library/functions.html?highlight=filter#filter) built-in function. 3. the [_str.islower()_](https://docs.python.org/3 More
deepcopy, 2 x def-Alexona 1
Hi, look at: 1. [_fractions.gcd()_](https://docs.python.org/3.5/library/fractions.html?highlight=fractions.gcd#fractions.gcd) 2. and [_functools.reduce()_](https://docs.python.org/3.5/library/functools.html?highlight=functools.reduce#functools.reduce). More