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-aisilunya
Hi, ad `a`: You don't need list() as `phrases` is iterable => You don't need that variable at all. ad `b`: x is a __str__ so _str()_ is redundant. And also as `phrases` is __tuple__ of __str__ you can write: b = ",".join(phrases) and `c`: You don't need it. You can chain methods: return More
First-aisilunya
Hi, remove _print()_ function(s) before publishing. It's a good practice. More
Simple is best-JanKaifer
Hi, unstead of `mylist += [element]` you can write `mylist.append(element)`. More
Simple is best-JanKaifer
Hi, for this you can use _str.replace()_ and _str.join()_. More
Simple is best-JanKaifer
Hi, 1. instead of `i in big` you could use `i.isupper()`. 2. for this case the _filter()_ built-in is ideal: # Python 2.7 return filter(unicode.isupper, text) # Python 3.3 return "".join(filter(str.isupper, text)) More
Simple is best-JanKaifer
Hi, 1. _bin()_ returns __str__ so _str()_ is redundant. 2. look at _str.count()_. More
First-jirka.hrbek 1
Hi, 1. Line 3: `[]` are redundant. 2. Look at `Counter` in `collections` module. More
Best cheat-JanKaifer
Dictionary cheat :) def days_diff(date1, date2): try: return {((1982,4,19),(1982,4,22)): 3, ((2014,8,27), (2014,1,1)): 238, ((1,1,1), (9999,12,31)): 3652058, ((9999,12,31), (1,1,1)): 3652058, ((2 More
First-Leolo
Hi, I've played with your code. [Here](http://www.checkio.org/mission/brackets/publications/suic/python-27/leolos-shortened/) is the result. :) More
First-Kilaruna
Hi, `lambda` is redundant here. _abs()_ is already a function, so you can write: return sorted(numbers_array, key=abs) More
First-Kilaruna
Hi, 1. look at _sum()_ and _generator expressions_. 2. __bool__ is a _subclass_ of __int__. More
First-Djekke 1
Hi you could use _any()_ instead of that `for` loop. More
First-nastyajeid 1
Hi, you don't need that "else cascade" in the end. 1. Instead of `'a' <= x <= 'z'` you can use `x.islower()`. 2. Instead of `'A' <= x <= 'Z'` you can use `x.isupper()`. 3. Instead of `x in b` you can use `x.isdigit()`. 4. Line 14: `if number and u_letter and l_letter:` etc. More
First-jollyca
Hi, I have a few comments: 1. What is the point of using enumerator if you don't use _i_? 2. In fact you do everything twice. More
First-Zophar78
Hi, you could use _sum()_ with _generator expression_ instead of `for` loop and `result` variable. More
First-mohamed.amer.tarak 1
Hi, Python is not C. I'm not sure if this is speedy, have you measured it? More
Second-mohamed.amer.tarak 1
Hi, have a look at _filter()_. More
First-tehtactics19
Hi, this is one of the standard solutions. It's just. On the other hand you could write it as a one-liner, but it's not necessary. :) More
First-Rahul_Badenkal
Hi, 1. Look at _filter()_ and _str.join()_. 2. You could write `b += a` instead of `b = b + a`. 3. Look at _str.isupper()_. More
First-Rahul_Badenkal
Hi, you could write this sum(array[::2]) # instead of: sum(x for x in array[::2]) If `array` is not empty: array[-1] == array[len(array)-1] More