40
Last seen 4 days ago
Member for 9 years, 10 months, 19 days
Difficulty Advanced
Hi, this is reinventing the wheel. Look at _str.islower()_, _str.isupper()_, _str.isdigit()_.
More
Hi, why generator expression? When you first join, then you can use _str.replace()_.
More
Hi, you can avoid the else if :)
return len(array) and return array[-1]*sum(array[::2])
More
Hi, you don't need to sort the words => _sorted()_ is redundant.
You can use a more functional approach:
return sum(x in text.lower() for x in words)
More
Hi, you can unpack the _date1_ and _date2_ tuples with *.
d1 = date(*date1)
d2 = date(*date2)
More
Hi, if...else is redundant:
return len(set(filter(str.isalpha, text.lower()))) == 26
More
... two thumbs, but those [] on line 59 are redundant :)
More
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
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
Hi [] are redundant. You can write:
return sum(c in txt.lower() for c in words)
More
Hi, `list1` and `str1` are redundant:
return ''.join(re.findall('[A-Z]*', text))
More
Hi,
1. `&` means [_set intersection_](https://docs.python.org/3.4/library/stdtypes.html#set.intersection) in Python. Use `and` instead.
2. You could move line 10 inside the for loop and return the condition:
return number and lower and upper
More
Hi `x` is redundant:
return "".join(findall('[A-Z]', text))
P. S.: You can solve it without using __re__.
More