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-ByteCommander 1
Hi, 1. You could write: `friday13 += (date(year, month, 13).isoweekday() == 5)`. 2. Look at _sum()_. More
Common Words-EfGnevsheva
Hi, look at [__(frozen)set__](https://docs.python.org/3.5/library/stdtypes.html#set-types-set-frozenset). More
Passchek using any()-lameei
Hi, the `if...else...` is redundant: return any(...) and any(...) and ... # is enough More
3 regex-val0u
Hi, those `bool()` aren't necessary. You could write: return bool(len(data) >= 10 and num.search(data) and upper.search(data) and lower.search(data)) # or even: return len(data) >= 10 and all(x.search(data) for x in (num, lower, upper)) More
"short" comprehension list -val0u
Hi, `range(0, x) == range(x)`. More
Using any!-Anas_Alzahrani
Hi, 1. All `== True` checks are redundant. 2. All `else` branches are redundant. 3. Finally: When you use _any()_ with `and` or _all()_ all the `if`s are redundant. Your code after step 2.: def checkio(data): if len(data) >= 10 : if any(c.islower() for c in data): if More
First-Rosetta93 1
Hi, `len` is redundant: if len(data): ... else: ... More
Emily HK-emilyhoughkovacs 1
Hi, I have a two comments: ~~~~ # 1) return cond # is the same as: if cond: return True else: return False # 2) You can shorten is_palindrome like this: def is_palindrome(text): return text == text[::-1] More
Emily-emilyhoughkovacs
Hi, this is better :) I would make a slight change: Assign this `text[i:j]` to a variable e. g.: def longest_palindromic(text): pal = '' for i in range(len(text)): for j in range(i, len(text)+1): subst = text[i:j] if len(subst) > len More
One Line-thierry.kleinhentz
Hi, look at [_extended slices_](https://docs.python.org/3/whatsnew/2.3.html?highlight=extended%20slices#extended-slices). More
HELLO-laetrid
Hi, this is inefficient because __str__ is immutable i. e. each `result += char` creates a new string. You could use: 1. [_filter()_](https://docs.python.org/3/library/functions.html?highlight=filter#filter) or [_generator expression_](https://docs.python.org/3/whatsnew/2.4.html?highlight=generator More
First-Jason721
Hi, 1. _list()_ is redundant. [_filter()_](https://docs.python.org/3/library/functions.html?highlight=filter#filter) returns an _iterable_ which [_str.join()_](https://docs.python.org/3/library/stdtypes.html?highlight=join#str.join) can consume. 2. __str__ has [_str.isupper()_](https://docs.python More
First-Bidonus
Hi, all the `if`s are redundant: ~~~~ # as: if cond: return True else: return False # is the same as: bool(cond) # when the condition is itself a bool than bool() is redundant # and: if cond_a: if cond_b: ... # is the same as: if cond_a and cond_b: ... # ------------ More
Probably not the best solution, but I did it all by myself (beginner)-gary.d.russell
Hi, you could write: 1. `return not len(alphabet) > 0` instead of lines 7-10 2. `alphabet = list(string.ascii_lowercase)` 3. `text = text.lower()` More
One-line solution-eredinbg
Hi, you don't need math.pow. There's a power operator in python: **. More
Index Power-thinkdefacto
Hi, `a` is redundant. You could write: `return array[n] ** n`. More
First-Ceph3
Hi, few tips: 1. It's better to put the whole expression in parentheses instead of using ugly backslashes. 2. `and` is short circuiting. 3. Look at the _all()_ built-in function. 4. and combine it with a generator expression. See my [refactored version](https://checkio.org/mission/house-password/p More
First-miyachi78
Hi, 1. _list()_ is a built-in function, don't use it as variable name. 2. Look at list comprehensions. More
xor & sum-RadekBrich 1
Hi, _list()_ is redundant as __str__ is iterable. More
First-pruidzeko
Hi, instead of the condition on line 6 you could write: sum(i.isdigit() for i in data) # or even better any(i.isdigit() for i in data) Other option is to combine _sum()_ and _filter()_ sum(filter(str.isdigit, data)) More