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-ViacheslavHaidei
Hi, _bin()_ return __str__ which is iterable, you don't need those indices to access elements: def checkio(number): b_str = bin(number) count = 0 for e in b_str: if e == '1': count += 1 return count # or use str.count() metho More
First-ViacheslavHaidei
Hi, you can write: count += 1 More
oneliner-AlexanderPavlichuk
Hi, _str()_ is redundant. _bin()_ return __str__. More
Very Clear-texom512 2
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
First-ViacheslavHaidei
Hi, 1. __str__ is iterable 2. `d` id redundant. 3. Line 8 is redundant. def checkio(number): res = 1 s = str(number) for e in s: if e != '0': res * int(s[i]) return res # or even for e in str(number): More
First-ViacheslavHaidei
Hi, n in range(len(array)) is not a good way. Check this: 0 <= n < len(array) More
100% Clear-texom512 2
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
First-ViacheslavHaidei
Hi, 1. this: if gb: flag = True else: flag = False return flag you can simply return `gb`: return gb 2. You can replace all that `#search` code with _str.isalpha()_. 3. In fact you don't need `gb` and `flag` variables: def checkio(words): count More
First-ViacheslavHaidei
Hi, Python has __set__ which has _set.intersection()_ method and there's even a set intersection operation `&`. Also look at _sorted()_. def checkio(first, second): set1 = set(first.split(",")) set2 = set(second.split(",")) return ",".join(sorted(set1 & set2)) More
First-GabrielHahmann 1
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
First-ViacheslavHaidei
Hi, __str__ is not good type for accumulating values as it's immutable. Look at _filter()_ function. More
First-HarryV
Hi, look at _filter()_ built-in and the _str.join()_ method. return "".join(filter(str.isupper, text)) More
First-EthyBOX
You with _filter_ you can make it even shorter. More
easiest?-tilikum
Hi, ans is redundant you can: return max(args) - min(args) More
FirstLab-tilikum
Hi, the _and number % ... != 0_ checks are redundant, you could remove them. More
First-Wulstigemoehre
Hi, `else` branch is redundant: if len(a) > 0: ... return 0 More
First-bajun01
Hi, why not str.isupper instead of: (letter.islower() == False) and (letter.isalpha() == True) #? More
First-pruvosim
Hi, he last if does not make sense, as you return the same in both branches. You could write: return False. More
First-pruvosim
Hi, try to look at list comprehensions and generator expressions in python. E. g.: result = [w for w in text if w.isupper()] More
First-evoynov 1
Hi, look at str.isupper: # You could write: l.isupper() # instead of: ord(l) in range(ord("A"), ord("Z")+1) More