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
Digits Multiplication -schanjr
Good one! P. S.: You can omit the >= 1 at the end. More
Second-gunlinux 1
Hi, 1. You don't need that `lambda`. You can use _mul()_ from `operator` module or simply _int.\_\_mul\_\_()_. 2. You could use _map()_ and _str.replace()_ instead of that list comprehension: return reduce(int.__mul__ , map(int, str(number).replace("0", ""))) More
First-narumi.kano.3
Hi, one tip: When you are unpacking values and don't use some of them, you can use _ instead of adding dummy names: # E. g. phonedate, _, seconds = call.split() # instead of phonedate, phonetime, seconds = call.split() More
First-Slepice1
Hi, with all() you could make it a one-liner. More
First-WpoZoo 1
Hi, one comment: I would replace lines 13-15 with one line: # You can apply map(int, ) directly on splitted_data # and use it as argument of date year, month, day = map(int, splited_data[0].split('-')) # In fact you can eliminate these these three variables call_data More
itemgetter-gyahun_dash
Hi, interesting. I didn't know about itemgetter(). More
First-Amachua
Hi, I would write: def total_cost(calls, allowed=100): ... More
defaultdict-ciel
Hi, I didn't know about method caller. Thanks. More
AngelRaposo-AngelRaposo
Hi, comments are fine, but they make the code less readable. Splitting to paragraphs would make it more readable. E. g.: # To simplify the code, we use a defaultdict of lists that will contain # one entry per day containing all the minutes used by calls daily_calls = defaultdict(li More
First-dagger126 1
Hi, nice solution. There's one thing: As you don't use _time_ variable, you could write: data, _, seconds = i.split() More
First-panther-king 1
Hi, it's very easy to read ;) I have two little comments: 1. You don't use the _t_ variable, so you could write: d, _, s = call.split(' ') 2. But you could use it to reduce duplication: t = math.ceil(int(s) / 60) if d not in seconds: seconds[d] = t ... More
First-Victor.Mlnk
Hi, this a C-style solution. Try to look at _extended slices_ and _sum()_. More
Small shit-zymtom
Or a big one? :D 1. Look at _extended slices_: `array[::2]` 2. _sum()_ built-in function: `sum(array[::2])` 3. You could write `i += 2` More
First-Victor.Mlnk
Hi, _min()_ and _max()_ are built-in functions. More
First-gregi87
Hi, a bit shoter version: def count_neighbours(grid, row, col): sg = lambda t: save_get(grid, row + t[0], col + t[1]) return sum(map(sg, ((-1,-1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, More
First-gregi87
Hi, `reslist` is redundant: return [x for x in data if c[x] > 1] More
dict and one-line function-waxdesf 1
Hi, actually those comments make it less readable. A few empty lines would make the thing. E. g.: # format odd items (n_:n_:n_) from len(4) to len(3) representation form = list(map(lambda x: x[1][1:] if not x[0]%2 else x[1], enumerate(mors))) # join hh, mm, ss, add ' : ', and remov More
dict-magdre
Hi, I know... CTRL+C, CTRL+V is easy, but have this one int(i[19:])//60 + bool(int(i[19:])%60) two times... hmmm More
First-magdre
Hi, this is a bit "overparthesized", especially this: str((int(i[1])-1)) # why not: str(int(i[1])-1) Anyway, line 5 and 6 contains almost the same code. I've been playing a bit and reduced it to this: return sum(any(columns[columns.index(i[0]) + n] + str(int(i[1])-1) More
First - Call to Home-AQiccl135 2
Hi, ... as if I was looking of code of my colleague :) It's nice to have comments, but without visual separation they make code hard to read. Blank lines are useful, but some people (including my colleague) don't like them. E. g.: # Splits each call into usable information duration = [ More