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
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-ekkot 1 1
Hi, it's better to avoid complex lambdas in `reduce`. Regards, suic ```python # instead of if len(st) == 1: # - this is incorrect: checkio(9) == 9 return 1 # / return reduce(lambda x, y: int(x) * int(y), b) # you can write return reduce(lambda x, y: int(x) * int(y), b, 1) # check http More
First-davidezal 1
This is so funny :) 1. "all the magic" (including `itertools.groupby`) on one-line. 2. wrapped by a typical newbie `if...else...` anti-pattern. ```python return ( subj.isupper() # bool or subj.endswith('!!!') # bool or any(...) # bool ) More
First-pushpam 1 1
Hi, you can omit the else and dedent (or outdent?) lines 7-14. 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
Simple is best-JanKaifer 1
Hi, whatabout _str.endswith()_? 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
First-anonymorf 1 1
Hi, lines 3-6 represent a common newbie anti-pattern: # Step 1: the condition is a bool so if..else is redundant x = search('([A-z]+ [A-z]+ [A-z]+)', words) return x # Step 2: x is redundant return search('([A-z]+ [A-z]+ [A-z]+)', words) 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
First-anonymorf 1 1
Hi, lines 2, 4 and 5 are pointless. Look at the documentation to [*args](https://docs.python.org/3.4/tutorial/controlflow.html#arbitrary-argument-lists). def checkio(*args): try: return max(args) - min(args) except ValueError: return 0 # That's it More
First-anonymorf 1
Hi, 1. Lines 8-16 reminds me: ["Empty spaces - what are we living for..."](https://vimeo.com/19166601) :D 2. `n` and `y` are redundant and return value doesn't have to be parenthesized. 3. Line 4: `arr[0:len(arr):2] == arr[::2]` and for non-empty lists: `arr[len(arr)-1] == arr[-1]`. return su More
First-inga.s 1
Hi, the built-in [__set__](https://docs.python.org/3.5/library/stdtypes.html?highlight=str.count#set-types-set-frozenset) object is better for this purpose than __list__. Look at [_set.intersection()_](https://docs.python.org/3.5/library/stdtypes.html?highlight=str.count#set.intersection). More
First-inga.s 1
Hi, when you have the following pattern: if condition: continue else: do_something is better to rewrite it like this: if not condition: do_something e. g.: if len(result) != 0: del result[0] Then have a look at [this](https://docs.python.org/3.5/l More
return not any()-Alexona 1
Hi, 1. this `text.lower().find(l) == -1` is very un-pythonic. One of the most useful and powerful thing in Python is `in`: return not any(l not in text.lower() for l in letters) # or: return all(l in text.lower() for l in letters) 2. You could use `string.ascii_lowercase` instead More
Fizz Buzz-illion 1 1
Hi, you don't need the `result` variable as well as the `number` variable. Line 19 is redundant. More
First-rdmar13 1 1
Hi, look at _str.isupper()_, _str.isupper()_ and _str.isdigit()_. More
simple sum-Alexona 1
Hi, _bin()_ returns a __str__, which has _str.count()_ method: return bin(number).count('1') # That's it :) More