Oct. 30, 2014, 5:10 p.m. |
+ 1 |
for Comment
veky: Only few things... Names starting with uppercase are usually not used locally. In line 4, look at th...
|
Oct. 30, 2014, 4:51 p.m. |
+ 1 |
for Task
Math Ghost
|
Oct. 13, 2014, 6:48 p.m. |
+ 1 |
for Comment
emnkugler: In the [comments on another solution](http://www.checkio.org/mission/humpty-dumpty/publications/htam...
|
Oct. 1, 2014, 4:48 p.m. |
+ 2 |
for
First-skyJuice
|
Oct. 1, 2014, 4:47 p.m. |
+ 4 |
for
First-gyahun_dash
|
Sept. 18, 2014, 8:41 p.m. |
+ 2 |
for
First-Eightfoldx
|
Sept. 17, 2014, 4:07 p.m. |
+ 1 |
for Task
Simplification
|
Sept. 16, 2014, 5:03 p.m. |
+ 1 |
for Comment
rupadhya: Awesome visualizer for interactive python code. Checkout recursions. http://pythontutor.com/ .
|
Sept. 16, 2014, 4:59 p.m. |
+ 1 |
for Comment
veky: Here is a resource. Whenever you see lambda args: expression replace it with tempfunc, where in the ...
|
Sept. 10, 2014, 2:50 p.m. |
+ 1 |
for Comment
bukebuer: You're right. I underestimate the complexity of all possible maps. Need to find some other algorithm...
|
Sept. 5, 2014, 10:08 p.m. |
+ 1 |
for Comment
ale1ster: You mean: def boolean(x, y, op): return eval(op)(x, y) ?
|
Sept. 3, 2014, 6:09 p.m. |
+ 2 |
for
First-Sim0000
|
Sept. 3, 2014, 6:09 p.m. |
+ 2 |
for
Eval (downvote scapegoat)-ale1ster
|
Sept. 3, 2014, 5:47 p.m. |
+ 1 |
for Comment
veky: Many. :-) EAFP. Read [this](http://www.checkio.org/mission/number-radix/publications/tdietert/python...
|
Sept. 3, 2014, 5:47 p.m. |
+ 1 |
for Comment
veky: Python's len is always constant time. BDFL's dictum. :-) That's why, e.g. you can't take len of a ge...
|
Sept. 3, 2014, 5:46 p.m. |
+ 1 |
for Comment
krzychusan: Theoretically speaking I would suggest to handle empty list case. Currently this will go into infini...
|
Sept. 3, 2014, 5:46 p.m. |
+ 1 |
for Comment
nickie: Some of what I'll say has already been discussed, but let me add my two cents. There are several way...
|
Sept. 3, 2014, 5:45 p.m. |
+ 1 |
for Comment
veky: I don't know what rule are you talking about. :-) But EAFP is just a "rule of the thumb", not some h...
|
Sept. 3, 2014, 5:44 p.m. |
+ 1 |
for Comment
ichaleynbin: I quoted it by rereading it... and yeah I couldn't find EAFP in any of the PEPs. I do know it's basi...
|
Sept. 3, 2014, 5:43 p.m. |
+ 1 |
for Comment
ichaleynbin: Not denying that it's EAFP. Heh I just recommended to somebody the other day to read the zen of pyth...
|
Sept. 3, 2014, 5:43 p.m. |
+ 1 |
for Comment
veky: Do re-read it. You might be surprised that EAFP is not there. ;-] It was not Python's idea, it's a g...
|
Sept. 3, 2014, 5:42 p.m. |
+ 1 |
for Comment
veky: > Lots of things can get lost in try:except, though at least you specified an error, which helps to ...
|
Sept. 3, 2014, 5:41 p.m. |
+ 1 |
for Comment
ichaleynbin: I don't think I'd have caught that until I caught a recursion limit reached error. I disagree about ...
|
Sept. 3, 2014, 5:41 p.m. |
+ 1 |
for Comment
veky: My comments were not about speed, but about clarity, bug avoiding (you don't have to think about pre...
|
Sept. 3, 2014, 5:40 p.m. |
+ 1 |
for Comment
ichaleynbin: Good call. You're right, for anything longer than a list of two, try:except will be faster, and at t...
|
Sept. 3, 2014, 5:40 p.m. |
+ 1 |
for Comment
veky: Much more pythonic is: def checkio(data): try: return data[0] + checkio(data[1:]) except IndexError:...
|
Sept. 3, 2014, 5:38 p.m. |
+ 1 |
for Comment
veky: > I hope to not replicate something similar to this in the future! Don't be afraid to make mistakes....
|
Sept. 3, 2014, 4:22 p.m. |
+ 3 |
for
SecretMessage-vikaspace
|
Sept. 3, 2014, 3:59 p.m. |
+ 2 |
for
Indexcept-veky
|
Sept. 3, 2014, 3:55 p.m. |
+ 1 |
for Comment
magdre: yes yes ,that i just want,but i forgot before published.
|
Sept. 3, 2014, 3:19 p.m. |
+ 2 |
for
First-magdre
|
Sept. 2, 2014, 4:58 p.m. |
+ 1 |
for Comment
vinc: Correct url for '**Are Annotations the Future?**': [http://sdtimes.com/python-creator-proposes-type-...
|
Aug. 29, 2014, 7:55 p.m. |
+ 3 |
for
Regex-tarikki
|
Aug. 28, 2014, 5:50 p.m. |
+ 3 |
for
Second. Simplified realisation-vinc
|
Aug. 27, 2014, 8:29 p.m. |
+ 1 |
for Comment
bunnychai: how about assert shot((0, 0), (1, 1), (3, 3), (2, 2)) == 0, "shot in butt of wall" ?
|
Aug. 27, 2014, 8:29 p.m. |
+ 1 |
for Comment
bukebuer: I remember such case was included in the old version of the task and solved it. However, when solvin...
|
Aug. 27, 2014, 8:28 p.m. |
+ 3 |
for
First-suic
|
Aug. 27, 2014, 8:27 p.m. |
+ 2 |
for
ShootRange-bunnychai
|
Aug. 25, 2014, 4:22 p.m. |
+ 1 |
for Comment
veky: Yes, kind of. In fact p = lambda x: x > 10. And of course there can _be_ suitable x in the sequence,...
|
Aug. 25, 2014, 4:21 p.m. |
+ 1 |
for Comment
veky: Ok, let's try this way. You kno de Morgan laws? Even if you don't, try saying in Python "no x in c s...
|
Aug. 25, 2014, 4:21 p.m. |
+ 1 |
for Comment
veky: > If any(data) is False how can be all(data) True? Exactly when data is empty. Of course. > It seems...
|
Aug. 25, 2014, 4:20 p.m. |
+ 1 |
for Comment
hanpari: Thank you, at least it seems to me pretty tricky.
|
Aug. 25, 2014, 4:20 p.m. |
+ 1 |
for Comment
coells: Not seeing a *logic* does not mean there is not one. :-) all(iterable) -> bool Return True if bool(x...
|
Aug. 25, 2014, 4:19 p.m. |
+ 1 |
for Comment
bryukh: But this is written in "help" all(...) all(iterable) -> bool Return True if bool(x) is True for all ...
|
Aug. 15, 2014, 8:33 p.m. |
+ 4 |
for
AngelRaposo-AngelRaposo
|
Aug. 15, 2014, 8:33 p.m. |
+ 1 |
for
First-cbrunet
|
Aug. 15, 2014, 8:31 p.m. |
+ 1 |
for Comment
veky: Best reinventing the wheel ever. :-P
|
Aug. 15, 2014, 8:31 p.m. |
+ 2 |
for
Naive-Sim0000
|
Aug. 15, 2014, 8:30 p.m. |
+ 1 |
for Comment
artemrudenko: You can use getattr(hashlib, algorithm) instead of if here. In any case - cool.
|
Aug. 15, 2014, 8:29 p.m. |
+ 1 |
for Comment
veky: I don't get it, why don't you just import hashlib directly??
|
Aug. 15, 2014, 8:29 p.m. |
+ 1 |
for Comment
Wei5: Because you could not do that. You can do it now because this problem is too difficult for beginners...
|
Aug. 15, 2014, 7:15 p.m. |
+ 3 |
for
via recurssion-pax0r
|
Aug. 15, 2014, 7:11 p.m. |
+ 4 |
for
First-CimpaMiroslav
|
Aug. 15, 2014, 7:10 p.m. |
+ 1 |
for Comment
Cjkjvfnby: It can be more cute and clever with string format: return eval('%c%c%c(%s)' % (115, 117, 109, x))
|
Aug. 15, 2014, 7:10 p.m. |
+ 1 |
for Comment
aotus: This is in the "clear" category? It's cute. It's clever. It's cheating! :^)
|
Aug. 14, 2014, 6:47 p.m. |
+ 1 |
for Comment
tihenko: Understanding code written by another person? This is not for newbies! :о)
|
Aug. 14, 2014, 6:47 p.m. |
+ 1 |
for Comment
ale1ster: I think that is the whole point...
|
Aug. 13, 2014, 4:29 p.m. |
+ 2 |
for
Second-gyahun_dash
|
Aug. 13, 2014, 4:28 p.m. |
+ 1 |
for Comment
Lijantropique: Hello Gyahun_dash, Do you mind explaining to me why you use "c:'sides'" in line 9? I tried your code...
|
Aug. 13, 2014, 4:28 p.m. |
+ 1 |
for Comment
bryukh: Did you try this in py3?
|
Aug. 13, 2014, 4:28 p.m. |
+ 1 |
for Comment
Lijantropique: Hello Bryukh, I use normally 2.7 and I didn't realize this code was P3 (my bad). However, this morni...
|
Aug. 13, 2014, 4:28 p.m. |
+ 1 |
for Comment
gyahun_dash: It is **annotation** introduced in py3. Let's try it.
|
Aug. 13, 2014, 4:28 p.m. |
+ 1 |
for Comment
bryukh: I had tried this code in pythontutor and didn't get an error.
|
Aug. 13, 2014, 4:28 p.m. |
+ 1 |
for Comment
Lijantropique: Hello Bryukh, That was my point. The program runs **without** errors but nothing special happened (I...
|
Aug. 13, 2014, 4:27 p.m. |
+ 1 |
for Comment
aotus: My solution was essentially the same, except that I defined my equivalent to area_function globally....
|
Aug. 13, 2014, 4:27 p.m. |
+ 1 |
for Comment
gyahun_dash: As you say, the dictionary is re-defined. If we need more speed, it should be defined globally like ...
|
Aug. 13, 2014, 4:27 p.m. |
+ 1 |
for Comment
aotus: Pardon the strange formatting in my message. It appears that the underscore character is interpreted...
|
Aug. 13, 2014, 4:27 p.m. |
+ 1 |
for Comment
gyahun_dash: When you use underscores in comments, you may insert \ in front of them.
|
Aug. 12, 2014, 6:21 p.m. |
+ 1 |
for
_-blaxmi
|
Aug. 12, 2014, 6:14 p.m. |
+ 3 |
for
First-contrebasse
|
Aug. 12, 2014, 6:14 p.m. |
+ 3 |
for
First-Tsutomu-KKE
|
Aug. 11, 2014, 6:32 p.m. |
+ 1 |
for
First-hawaiix
|
Aug. 11, 2014, 6:17 p.m. |
+ 2 |
for
First-the0d
|
Aug. 11, 2014, 6:01 p.m. |
+ 1 |
for Comment
SimonMontford: '<' and '>' are excluded from the problem in a 'more real' situation, you would trip up on '[(4 + 5)...
|
Aug. 11, 2014, 6 p.m. |
+ 1 |
for Comment
Tiktin: OPEN_BRACKETS = {a for a, _ in BRACKET_PAIRS} Why did you use a set (curly brackets) instead of a li...
|
Aug. 11, 2014, 6 p.m. |
+ 1 |
for Comment
PositronicLlama: OPEN_BRACKETS = {a for a, _ in BRACKET_PAIRS} I did use a set for efficiency. A set uses more memory...
|
Aug. 11, 2014, 5:59 p.m. |
+ 1 |
for Comment
Tiktin: BRACKET_PAIRS = ['()', '{}', '[]', '<>'] Lines 3-5 can be replaced by explicitly defining just the C...
|
Aug. 11, 2014, 5:59 p.m. |
+ 1 |
for Comment
PositronicLlama: Lines 3-5 are certainly unnecessary, but they are potentially worthwhile as an optimization. Looking...
|
Aug. 11, 2014, 5:57 p.m. |
+ 3 |
for
First-f_rin_kazan
|
Aug. 6, 2014, 6:02 p.m. |
+ 1 |
for Comment
Cjkjvfnby: please read about python naming convention and code style. legacy.python.org/dev/peps/pep-0008/ you ...
|
Aug. 6, 2014, 5:48 p.m. |
+ 1 |
for Comment
pohmelie: Okay… maybe this is idea for new task. Something like "maximum count of disjoint words". Cause in de...
|
Aug. 6, 2014, 5:48 p.m. |
+ 1 |
for Comment
bryukh: It's just for fun. Of course you can make the new task :-) It will be great.
|
Aug. 6, 2014, 5:47 p.m. |
+ 1 |
for Comment
pohmelie: What about case when text = "abcd" and words = {"abc", "bcd"}? I think words can't intersects, but s...
|
Aug. 6, 2014, 5:47 p.m. |
+ 1 |
for Comment
bryukh: > You should count how many words are included in the given text. "abs" is included, "bcd" is includ...
|
Aug. 6, 2014, 5:46 p.m. |
+ 2 |
for
First-shota243
|
Aug. 6, 2014, 5:46 p.m. |
+ 3 |
for
monkey-typing --> s7even-s7even
|
Aug. 6, 2014, 5:24 p.m. |
+ 1 |
for
Third-gyahun_dash
|
Aug. 5, 2014, 8:39 p.m. |
+ 4 |
for
Dynamic Programming O(N^3)-PositronicLlama
|
Aug. 5, 2014, 7:46 p.m. |
+ 2 |
for
First-ciel
|
Aug. 5, 2014, 7:43 p.m. |
+ 2 |
for
Recursive targeting-DiZ
|
Aug. 4, 2014, 5:33 p.m. |
+ 1 |
for Comment
guido: def min_diff(self, stones): What should the answer be if stones is an empty list? I think it should ...
|
Aug. 4, 2014, 5:33 p.m. |
+ 1 |
for Comment
guido: best = None If you initialize best to a large enough value you won't need to special-case "best is N...
|
Aug. 4, 2014, 5:32 p.m. |
+ 1 |
for Comment
guido: max_size = math.ceil(len(stones) / 2) Use the // operator ("floor division") to do integer division ...
|
Aug. 4, 2014, 5:31 p.m. |
+ 1 |
for Comment
guido: best = diff At this point you can actually stop if best == 0: if best == 0: return
|
Aug. 4, 2014, 5:31 p.m. |
+ 1 |
for Comment
guido: return total * len(stones) / 2 See note about constants and big Oh notation below.
|
Aug. 4, 2014, 5:31 p.m. |
+ 1 |
for Comment
guido: y_size = math.floor(total / 2) + 1 Again, I think you can use // and avoid using the math module:
|
Aug. 4, 2014, 5:31 p.m. |
+ 1 |
for Comment
guido: return x + x_size * y It's clear that you really want a two-dimensional list; then you could just wr...
|
Aug. 4, 2014, 5:30 p.m. |
+ 1 |
for Comment
guido: for x, s in enumerate(stones, 1): Your choice to start x at 1 seems odd -- in the code below, "x - 1...
|
Aug. 4, 2014, 5:30 p.m. |
+ 1 |
for Comment
guido: table[index(x, y)] = v PS. I'm not going to verify that this actually works; I'd get a headache. I t...
|
Aug. 4, 2014, 5:29 p.m. |
+ 1 |
for Comment
guido: approach = min(ALGORITHMS, key=lambda algorithm: algorithm.time(stones)) This is cute, but you don't...
|