40
suic
16 39 57
9966/ 10664
Last seen 1 day ago
Member for 9 years, 11 months, 4 days
Difficulty Advanced
Best reviews / Newest reviews
A sort-of functional approach-matyas.kuti
Hi, its a bit "agyonfunkcionalt" :): 1. All the lambdas are redundant as in a) Python functions are first class citizens and b) you can use the methods of built-in types directly. 2. In this case any_with_pred is also redundant. def checkio(data): predicates = [str.isdigit, str.islowe More
First-py_code
Hi, this is a misuse of _(x)range_. Look at extended slices: array[::2] # even elements More
Number Base-py_code
Hi, don't use _sum_ as a variable name. It's a built-in function. Look at documentation for [_int_](https://docs.python.org/3.4/library/functions.html#int). More
Absolute Sorting-py_code
Hi, lambda is redundant. _key_ expects a function and _abs()_ is a function, so: return sorted(number_array, key=abs) # is enough More
First-py_code
Hi, you could use the operation names as dictionary keys. More
First-py_code 1
Hi, the () around ','.join(phrases) are redundant. More
First-py_code 1
Hi [] are redundant. You can write: return sum(c in txt.lower() for c in words) More
regex and sets-SubramanyamS
Hi, on line 8, 9 the right-hand sides differs in one number. E. g.: even, odd = ({c for i,c in enumerate(word.upper()) if i%2==x} for x in (0, 1)) More
Map and Filter-SubramanyamS
Hi, list(filter(...)) and that _dictionary comprehension_ on line 10 are a bit overkill. It can be done with a one-line long _list comprehension_. More
First-miralin 1
Hi, ','.join() _aka_ str.join() which return __str__ so '%s' % is redundant. More
First-CoreyVaughan41
Hi, 1. Comments makes it hard to read. 2. What's the reason for this assignment: ref_list = string.ascii_lowercase? ascii_lowercase is just a string. 3. __set__ has _set.add()_ method so you don't need to use |=. 4. The last if is redundant: return len(new_set) == len(ref_list) P. S.: Yo More
First-CoreyVaughan41
Hi, 1. _bin()_ return a __str__, so str() is redundant. 2. __str__ has count method, so the for loop is redundant. More
First-diptiranjan
Hi, what does: else: pass do? Nothing. More
First-ZoeyKerr
Hi, the last if and all the == True tests are redundant: return a and b and c and len(data) > 9 def checkio(data): # If the string is not long enough you don't need the whole for loop if len(data) < 10: return False # a, b and c are bool values More
First-Natali_2_7
Hi, you can use * for unpacking _date1_ and _date2_: return abs(date(*date1) - date(*date2)).days More
First-Natali_2_7
Hi, nice one :) Can you make it a one-liner? :) First step is to remove the redundant _result_ variable. More
First-shipulinda
Hi, do not reinvent the wheel: Look at _str.join()_. More
Stack explained-MMM_AAA_NNN 1 1
Hi, a tip: indent your comments. More
Straightforward solution-MMM_AAA_NNN 1 1
Hi, straightforward... hmmm... but not pythonic: Look at extended slices and _sum()_ built-in function: array[::2] # even elements sum(array[::2]) # sum of even elements More
First-AlexanderPavlichuk 1
Hi, what's wrong with []? E. g. data[count/2 - 1]. More