57
veky
22 48 64 Leader of the month
44676/ 53887
Last seen 13 hours ago
Member for 11 years, 6 months, 24 days
Difficulty Advanced
We shall not cease from exploration, and the end of all our exploring will be to arrive where we started and know the place for the first time.

Best reviews / Newest reviews
Cant wait to see how you guys did it!-andrewg12
I think [this one](http://www.checkio.org/mission/digits-multiplication/publications/blabaster/python-3/golf/?ordering=most_voted) will floor you. :-D Also, // (and divmod) might be nice to learn. while number: number, digit = divmod(number, 10) if digit: product *= digit More
Moving on up!-andrewg12
See str.endswith. Your reinvention of it is very entertaining BTW. :-D More
THAT SOLUTION THO-andrewg12
What you did in first two cases, you can do in others, too. elif operation == 'implication': return not (x == 1 and y == 0) elif operation == 'exclusive': return x + y == 1 elif operation == 'equivalence': return x == y Those OPERATION_NAMES repeating are not giving you anything. Much More
I think this is the best!-andrewg12
Best compared to what? :-) You can have just one expression, ','.join(phrases).replace('right', 'left') And then you can just stick left_join = lambda phrases: at the beginning. :-) More
Crushing it!!!! -andrewg12
This is beginning to look a lot like Python, to paraphrase that old Christmas song. :-D The only jarring thing is that name in line 2. Just inline it, man. for word in words.split(): More
str-DiZ 1
Wow, what a cheat! :-D Of course it doesn't always work, but still very nice. Instead of (second) str, you can use id. It is false in rarer occasions. ;-] More
First-jake-g
def checkio(from_date, to_date): """Count Saturdays and Sundays between dates.""" weeks, days = divmod((to_date - from_date).days, 7) nd = from_date.weekday() + days # next same weekday as to_date return 2*weeks + (nd > 4) + (days and nd > 5) Same algo, 4 times More
First-ignalion
[since CiO will probably never get back links to commenter's solutions :-(, [here is the link to mine](http://www.checkio.org/mission/mind-switcher/publications/veky/python-3/zendoh/?ordering=most_voted), for comparison. This is a reply to ignalion's comment on my code.] While you might think our s More
First-Richard_Lenkiewicz 1
Using one-letter names is not really clear in most cases. Especially if those letters don't naturally denote these objects: `n` is ok, but what's `b`? Also, you can just return whatever you want directly instead of naming it and returning via name. More
bubble sort-tivvit
Too complicated. :-P And for line 7, look at reversed(). It might help. ;-) More
First-tivvit
No reason for val. Just return whatever you need in place. More
First-tivvit 1
Please don't semicolon. You have Py3, use it. Use // for int halving instead of heavy math. No () after keywords: `if len(data) % 2:` Consider using if-else expressions instead of doubling return. More
First-Drisbee
Why do you need lines 12~ the end? And what do you think they're doing? :-) More
First-Drisbee
1. What do you think line 4 is doing? (Answer: nothing useful.;) 2. Please use //. It is available in Py2 too. 3. instead of float(blah)/2, you can use blah/2.0 4. lengteArray is _longer_ than len(data). What did you intend to accomplish using it? 5. You can just return whatever you need, no rea More
First-brubru777 1
You can chain comparisons. ... if 'A' <= c <= 'Z' Though, of course, it's even simpler to use a method. ... if c.isupper() More
First-fasatrix
See `collections.Counter` instead of reinventing it. ;-) Also, that horrible line 5. How much time did it take for you to write it? if item not in ' -!@#$%^&*(){}[]|":?><,./;+=~0123456789': And you still forgot `'`, right? Much simpler: if item.isalpha(): More
First-fasatrix 1
Argh. This is just bad. Typos, Py2/Py3 confusion, misuse of sorted, a pointless "helping" function, superfluous print... sorry. No cookie for you. And definitely not clear. def checkio(lista): lista.sort() half, odd = divmod(len(lista), 2) return lista[half] if odd else More
Rings, links, bits and sets...-veky
... how many were going to [St. Ives](http://en.wikipedia.org/wiki/As_I_was_going_to_St_Ives#Lyrics)? :-D More
Naive-matuyuji
Naive is one problem. Unpythonic is much bigger problem here. ;-) Powerset is trying to be much more general (it's even global, as opposed to other aux functions:) and it is really unneeded here. First, if "iterable" _really_ was iterable, you wouldn't need line 6 (if it was _iterator_, then you'd More
Second-RomanKorbutyak
That's better. :-) But... `names` could benefit from set union. Concretely, `set().union(*self.collections)` is what you need. :-) Of course, then `connected` is just `names` on another collection of `Friends`. And when you have instances with just one piece of data, it makes sense to inherit. Py More