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-more_more_for
Hi, `data` is redundant: return [i for i in data if data.count(i) > 1] More
First-madfatcat
Hi, look at [Counter](https://docs.python.org/3.4/library/collections.html#collections.Counter). More
Functional solution-talha.zaman
Hi as data is a list of integers you don't need _operator.add()_: return reduce(int.__add__, data) More
First-yukirin 1
Hi, that `lambda` is redundant: checkio = sum More
First-ViacheslavHaidei
Hi, _bin()_ return __str__ which is iterable, you don't need those indices to access elements: def checkio(number): b_str = bin(number) count = 0 for e in b_str: if e == '1': count += 1 return count # or use str.count() metho More
First-ViacheslavHaidei
Hi, you can write: count += 1 More
First-ViacheslavHaidei
Hi, 1. __str__ is iterable 2. `d` id redundant. 3. Line 8 is redundant. def checkio(number): res = 1 s = str(number) for e in s: if e != '0': res * int(s[i]) return res # or even for e in str(number): More
First-ViacheslavHaidei
Hi, n in range(len(array)) is not a good way. Check this: 0 <= n < len(array) More
First-ViacheslavHaidei
Hi, 1. this: if gb: flag = True else: flag = False return flag you can simply return `gb`: return gb 2. You can replace all that `#search` code with _str.isalpha()_. 3. In fact you don't need `gb` and `flag` variables: def checkio(words): count More
First-ViacheslavHaidei
Hi, Python has __set__ which has _set.intersection()_ method and there's even a set intersection operation `&`. Also look at _sorted()_. def checkio(first, second): set1 = set(first.split(",")) set2 = set(second.split(",")) return ",".join(sorted(set1 & set2)) More
First-ViacheslavHaidei
Hi, __str__ is not good type for accumulating values as it's immutable. Look at _filter()_ function. More
First-HarryV
Hi, look at _filter()_ built-in and the _str.join()_ method. return "".join(filter(str.isupper, text)) More
First-Wulstigemoehre
Hi, `else` branch is redundant: if len(a) > 0: ... return 0 More
First-Wulstigemoehre
Hi `args=list(args)` is redundant. `args` is already iterable. More
First-tofguerrier
Hi. A small note: Using dictionary instead of if .. elif .. else could save you some typing. More
First-sajnin
You can you x ** 0.5 instead of sqrt(x). More
First-Tarty
It's nice and short. I was surprised that even the last line is shorter than 80 characters. :) Good job! More
First-austin.huff
Hi, 1. Line 2 is redundant: __tuple__ is iterable. 2. Line 3 and 4 are redundant: `return ','.join(x).replace('right', 'left')` Regards, suic More
First-Sabina 1
Hi, 1. _issufix()_ is redundant see [_str.endswith()_](https://docs.python.org/3.5/library/stdtypes.html?highlight=str.endswith#str.endswith) 2. `is not` and `!=` don't do the same thing (look at [this](https://docs.python.org/3.5/library/stdtypes.html#comparisons)) 3. Instead of: if word1 is More
First-Sabina 1
Hi, 1. look at the _sum()_ builtin: sum(int(digit) for digit in xnorm) 2. In fact, you just need to count the number of "1" in xnorm, therefore: return bin(n^m).count('1') More