57
veky
22 48 64 Leader of the month
44583/ 53887
Last seen 13 hours ago
Member for 11 years, 6 months, 6 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
Simple-geruz
Since "," not in "right", you can replace after joining. It would be shorter. ;-) More
First-emnkugler
You're fascinating. May I ask _what_ did you think when you wrote line 6? :-D More
First-oglop 1
Aaargh. My eyes hurt. :-P First, this is a classic example of how to go overboard with names. It would be _more readable_ if game_result was named just `r`. :-P And those comments should really be names. m_diag = r[0][0] + r[1][1] + r[2][2] Or even m_diag = ''.join(row[i] for i, row in More
First-RomanLubyanoy
This is a standard, and I hope intended, solution for this task. However, it's interesting to know that Python has a tool for specializing functions directly: functools.partial. So you don't have to define a new function, you just construct a partial object from sorted on key=abs, and name it checki More
If "000"-LuTze 1
A nice idea, but could be written much more directly. Check [this one](https://py.checkio.org/mission/three-words/publications/hrvoje/python-27/slightly-weird-solution/?ordering=most_voted&filtering=all) for example. :-) More
First-smirnoffs
This doesn't work like builtin min/max. >>> min(3) TypeError: 'int' object is not iterable >>> from checkio.min_max.smirnoffs.first import min >>> min(3) 3 I'm not saying your way makes less sense. :-) More
reduce-darthkylak
While you're importing, you can from operator import mul and use that as the first argument to reduce. :-) Also, if you're using reduce, you can go old school all the way and use map and filter too, instead of that ultramodern list comprehension. :-D More
First-darthkylak
`any(... for ...)` is better than `any([... for ...])`. Among other things, it shortcircuits the evaluation as soon as it finds a true value. List comprehension always constructs the whole list. More
smart-Orgams
Here is your solution in True Python: def checkio(data): res, vals = [], [(1000, 'M', 2), (500, 'D', 2), (100, 'C', 4), (50, 'L', 4), (10, 'X', 6), (5, 'V', 6), (1, 'I', None)] for val, rom, next in vals: res += data // val * rom data %= v More
comprehension-saharmel100
This is not a comprehension. :-) More
First-yarnaid 1
You're writing Python3, use it. :-) / works correctly, you don't need float(). And In line 3, you can use // directly instead of casting to int. Even better, since you need both // and % of same operands, it's better to calculate both at once: n, nudge = divmod(len(data)-1, 2) return (data More
I bet there are better ways...-clamytoe 1
You [win](https://py.checkio.org/mission/most-wanted-letter/publications/veky/python-3/key/?ordering=most_voted&filtering=all) the bet. :-D More
Unexceptional-veky
I finally got my `yield from`. :-D More
Mapped-kristof.jakab 2
List comprehensions are cool, but generator expressions are moar cool. :-) Just drop the brackets: ' '.join(v for k, v in ... if not number % k) The difference is that you don't construct a list of all the values at once, traversing it again when joining, but you construct values one by one, j More
little brute(force)-kristof.jakab 1
You don't need lines 6 and 7. Even if you did need them, raising a more specific thing like RuntimeError or even better ValueError, or even betterer OverflowError, would be more useful. Also, you can delete parentheses if you exploit the fact that multiplication is commutative. :-) converted + More
First-panaro32
`str.maketrans` would really help here. :-) And `t,h,d,m = map(int, str(n).zfill(4))`, of course. More
Recursive division-george.blackthorn
You can make it in one function without problems: rn = ((1000, 'M'), ...) def checkio(x, pos=0): try: num, rom = rn[pos] except IndexError: return '' else: return n // num * rom + checkio(n % num, pos + 1) Also, unpack instead of indexing. Also3, EAFP is powerful. ; More
Additive system-george.blackthorn
You don't need .keys(), and you don't need [] inside ''.join(). And cutone is a horrible name given what it's doing. :-P More
Components-george.blackthorn
`while bool(blah)` is exactly the same as `while blah`, only slower. You can also write `while bool(bool(bool(blah)))`. :-D And that `next(..., False)` pattern is much better expressed using EAFP in line 6, and simple `any` in line 11. More
First-Archagiel
Not speedy. Also, "data" rebinding is confusing. Just return it. More