40
Last seen 4 days ago
Member for 9 years, 10 months, 19 days
Difficulty Advanced
Hi, this is not pythonic:
1. `from math import *` ugh!!! Import everything from `math` for a function which you don't need... is the reason for thumbs down.
2. Look at `//`.
3. `if not data:` instead of `if len(data) == 0:`
4 `else` branch on lines 11-17 is redundant:
def checkio(data):
More
Hi, you have weird sense of clear. This solution is not pythonic, e. g.:
1. Import `string` is redundant.
2. __str__ has _str.islower()_, _str.isupper()_ and _str.isdigit()_ methods.
etc.
More
Hi, two comments:
1. Don't use _list_ as variable name. It's a [built-in type](https://docs.python.org/3/library/stdtypes.html?highlight=list#list). And it's also quite confusing as there's a _list.append_ in _list_ type, but you have to call it in a different way:
list.append(some_list,
More
Hi, why not str.isupper instead of:
(letter.islower() == False) and (letter.isalpha() == True) #?
More
Hi, he last if does not make sense, as you return the same in both branches. You could write: return False.
More
Hi, try to look at list comprehensions and generator expressions in python. E. g.:
result = [w for w in text if w.isupper()]
More
Hi, look at str.isupper:
# You could write:
l.isupper()
# instead of:
ord(l) in range(ord("A"), ord("Z")+1)
More
Hi,
1. Don't use _sum_ as variable name it is a built-in function.
2. Look at _list comprehensions/generator expressions_ and _str.join()_.
More
Hi, look at _all()_ and _generator expressions_:
return all(x in text.lower() for x in ascii_lowercase)
More
Hi, do not redefine _sum()_:
# This is shorter, nicer and faster
f = sum(map(abs, groups))
# than:
sum = reduce(lambda x, y : abs(x) + abs(y), groups)
More
Hi,
1. look at _any()_:
def contain(s, need): return any(c in need for c in s)
2. look at _str.isupper()_, _str.islower()_, _str.isdigit()_.
More