40
suic
16 39 57
9963/ 10664
Last seen 2 days ago
Member for 9 years, 10 months, 7 days
Difficulty Advanced
Best reviews / Newest reviews
First-MaikSchoepe 8
Hi, I like you solution except from it's repetitive nature, which you can avoid: base = "I"*data rs = (("I"*5, "V"), ("V"*2, "X"), ("X"*5, "L"), ("L"*2, "C"), ("C"*5, "D"), ("D"*2, "M"), ("DCCCC", "CM"), ("CCCC", "CD"), More
Stressful Regex-narimiran 6 2
Hi, two comments: 1. You could "precompile" the regexes and used the compiled version in `re.search`. 2. Instead of `(c for c in word)` you could write `iter()`. ```python import re def is_stressful(subj): matchers = [ re.compile('+[.!-]*'.join(iter(word)), re.I) for word in More
my own ugly code, publish it to supervise myself-Akemi_Homura 4 4
Hi, you could clean it up a bit. E. g.: 1. Remove the print statements 2. int(a, 10) == int(a) so you can omit the ", 10" 3. Try to look at [this](https://docs.python.org/2/library/stdtypes.html#truth-value-testing). # Because [] == False == 0: if stack != []: == if stack: if sta More
Super Simple Regex Solution-AaronCritchley 2 1
Hi, you can do it without _re_. [_filter()_](https://docs.python.org/3/library/functions.html?highlight=filter#filter) is perfect for this: return "".join(filter(str.isupper, text)) More
They don't did it! =(-ermichin158 2
Hi, one of the most important and powerful feature of Python is `in`: for word in words: now = 0; word = word.lower(); wordLength = len(word); while now < textLength - wordLength: if text[now:wordLength+now] == word: count+=1; More
First-Elenka79 2
Hi, I have some comments: 1. __str__ is not a good name as [__str__](https://docs.python.org/2/library/functions.html#str) is a built-in python class 2. Instead of defining str variable and checking s in str you could use the islower() method the __str__ class. Check help(str.islower). More
True mathematics-ermichin158 2
Hi, you could write `return sorted([A, B, C])`. More
2-liner: verify me-przemyslaw.daniel 2
Hi, nice one. You can write it like this: ```python verify_anagrams = lambda *a: list.__eq__(*map(f, a)) # or this from operator import eq ... verify_anagrams = lambda *a: eq(*map(f, a)) ``` Regards, suic More
Typecasting Basics-atheos 2 2
Hi, few things: 1. Commenting obvious things isn't a good practice. 2. `str` is iterable so there's no need to convert it to `list`. 3. `1` is the [identity element](https://en.wikipedia.org/wiki/Identity_element) of multiplication. (see below) 4. Look at `functools.reduce`. Regards, suic ```pyt More
First-mcsean 1 1
Hi, 1. You can have nested generator expressions/list comprehensions and there's the _all()_ built-in function. 2. You don't need to import re as you don't it. 3. data is __str__ which _is iterable_ so list() are redundant. 4. You don't the ifs in generator expressions: def checkio(data): More
First-hanpari 1 1
Nice, but I would shorten _eq_ a bit: eq = lambda w: sorted(filter(str.isalpha, w.lower())) More
Most Numbers-mbabkin 1
Hi, instead of: if len(args) == 0: ... you could write: if not args: ... More
First-hanpari 1 1
Hi, why not _filter()_?: "".join(filter(str.isupper, message)) More
Normally Solved-Golli19 1
Hi, 1. Line 14 is never reached. 2. Look at _list comprehensions_. More
Actual bit manipulation-pvdwijdeven 1 1
Hi, let's have a look at your `get_bin` function: ```python def get_bin(number): return (list(map(int, list(str(bin(number))[2:])))) ``` 1. `bin()` returns a __`str`__ => __`str`__ is redundant. 2. __`str`__ is iterable => `list` is redundant. ```python def get_bin(number): return list(map More
First-frantisek.jahoda 1
Hi, why not?: return sum(date(year, m+1, 13).weekday() == 4 for m in range(12)) More
while_robot-spoty 1
Hi, you can omit if r else "" as "".join([]) is "". :) More
First-Peter.White 1
Hi, instead of lines 2, 4-6 you can write this: return sum(word in ltext for word in words) More
FirstComeSolution-KarKarbI4 1 1
What a stairway. :) Look at _any()_. More
Product-spoty 1
Hi, a minor thing: checkio = lambda s: any(y != x and y.endswith(x) for x,y in product(s, s)) # or one-linerish :) checkio = lambda s: any(y != x and y.endswith(x) for x,y in __import__("itertools").product(s, s)) More