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-SmoUK
Hi, you could write: # empty array as treated as false: if not array: return 0 # total is redundant: return sum(array[::2]) * array[-1] More
First-SmoUK
Hi, don't use __str__ for accumulating values. It's immutable. More
First-SmoUK
Hi, that `== True` is redundant: if sub in text.lower(): total += 1 Tip: Look at _sum()_ and _generator expressions_. More
Even the last (Easy)-CodeHead
Hi, look at slices: `array[::2]` gives you the even elements. More
Third Excercise Solved!-CodeHead
Hi, there's so much in your code: 1. The last `if` and all those `== True` checks are redundant. 2. You perform all the checks for every element, which is not necessary. 3. If `data` is too short, you can immediately return. 4. That "create list from string exercise" on lines 6-10 is unnecessary. _ More
First-Tai
Hi, `ch.isupper()` returns a __bool__ therefore `== True` is redundant. You could safely omit it. More
First-CodeHead
Hi, 1. `character` is __str__ so _str()_ is redundant. 2. Look at _filter()_ and _str.join()_. More
First Excercise Explained-CodeHead
Hi, this is a good example, how you could make your code hard to read by adding comments. Good practice is to indent your comment and keep them short or wrapped. Sorry but some of those comments are ridiculous. Btw: Look at _docstrings_. E. g.: def checkio(data): """ The 'chec More
First-Tai
Hi, I have a few comments. 1. You could write `if y != 0:` instead of `if not (y == 0):`. 2. You could write `result *= y` instead of `result = result*y`. 3. Look at _list comprehensions_. More
First-Tai
Hi, you could write: def checkio(words_set): for w1 in words_set: for w2 in words_set: if w1 != w2 and w1.endswith(w2): return True return False or you could use _any()_ with _generator expression_. More
First-CodeHead
Hi, `gvalue` and `svalue` are redundant: return max(args) - min(args) More
First-CodeHead
Hi, all those nested if's are redundant. __boo__ is subclass of __int__. E. g.: elif operation == "equivalence": return x == y More
Three Words (Easy)-CodeHead
Hi, that last `if` is redundant: for i in new_word: if i.isalpha(): count +=1 if count == 3: return True return False More
First-Tai
Hi, this if count < 26: return False else: return True is a newbie antipattern. return count == 26 # is enough. Look at `string` module. It contains e. g. the `ascii_lowercase` constant. More
First-biscuits
Hi, you could use _enumerate()_. More
EvenTheLast-grifmang
arr[len(arr) - 1] == arr[-1] [] == False More
BinaryCount-grifmang
You can use str.count() to check the number of occurrences of a string in other string. Check help(str) in you python interpreter to check out usefull string methods. More
HighestMinusLowest-grifmang 1
Hi, in Python ([Truth Value Testing](https://docs.python.org/2/library/stdtypes.html#truth-value-testing)): False == () == '' == [] so you can replace this: if args == () or args == '' or args == []: with this: if not args: More
First-grifmang 1
Hi, I have a few comments: 1. String methods: data == data.upper() is the same as data.isupper() data == data.lower() is the same as data.islower() 2. You can use [__any__](https://docs.python.org/3.4/library/functions.html?highlight=any#any) instead of long if..elif...else. 3. Condition More
First-vitalik.parshin
You don't need to use lambda in this case: key=abs is the same as key=lambda x: abs(x) More