57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 18 hours ago
Member for 11 years, 5 months, 19 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.
Since so many people here adore your solution, I won't spend too much words about how beautiful it is. Instead I'll give you some advice how to make it better. ;-)
Line 3: This should really be a tuple of tuples. List kinda implies it will be changed, and it won't. At least the inner elements shoul
More
You don't need () inside [] when indexing by tuple. And f, s can be inlined there directly. Calculating them before doesn't get you anything.
More
Again, `set` has many nice operations. For example, `<=` (subset). ;-)
Also, don't write 'abcdefghijklmnopqrstuvwxyz' manually. If you forget a letter, in most cases you'll find out too late. There is a nice `string.ascii_lowercase` (you can use just `string.lowercase`, but don't:) that holds exact
More
It's strange that you didn't reuse area in volume.
And if you want to be a wizard, corners can be much more elegant using operator.attrgetter. ;-)
More
As the title says, I managed to write code that's shorter than FONT (by line _and_ character count). A few questions to think about if you're going to analyze the above code (in order of decreasing astonishment:):
1. What are those _two_ lambdas doing after checkio=? How come one of them doesn't
More
"Clear" shouldn't mean enormous code duplication and inventing the wheel from scratch. You should know about bin and int functions, bit_length method, and "not" keyword.
More
If you're not worrying about performance, "slice twice" is a good tactic to avoid duplicating start index:
word = text[index:][:size+1]
BTW, `reversed` builtin was added for a precise purpose of iterating in reverse. It would be nice to use it instead of [::-1].
for size in reversed(range
More
Short, yes. Simple, not really. Fast, I'd be surprised. :-)
Decorate / min / undecorate (https://en.wikipedia.org/wiki/Schwartzian_transform) is often used, and natively supported in Python through the `key` argument. When Python does it for you, it's probably faster. :-]
More
1. Functions h and v are too similar to warrant such duplication of code, don't you think? Just call one function c(o, x) with arguments 2 and 5, or if you want to be clear, curry o out and define h, v = c(2), c(5).
2. CheckiO is obsessed with lists (probably wrong kind of influence from LISP:P),
More
This is very wrong. docstrings aren't meant to be used like that. They are the help to someone _using_ your function, to explain what it is for - not for someone _reading_ your code, to explain how it is done. "count 1s in binary number" is a much better docstring (although it can be lenghtened to b
More
Yes, nice. BTW you don't need to convert str to list and then to set... set constructor will happily chew on str itself. :-)
More
Compared to [what](https://py.checkio.org/mission/bigger-price/publications/veky/python-3/connecting-the-dots/?ordering=most_voted&filtering=group)? :-D
More
Instead of lambda x: x.isupper(), you could have used unbound method str.isupper. That way, I guess it would be even speedier. ;-)
I don't know if Py2 has functools.partial, but if it has, this might be cool:
find_message = __import__("functools").partial(filter, str.isupper)
More
Who said I can't learn something new on Checkio? Today I learned about Jose Jalapeno. :-D
More
Ok, first: Too. Many. Comments. Really.
This is not C, where you write the code primarily for the processor, so you have to explain to the human readers as an afterthought. Here you write pseudocode, that is incidentally executable. Having so many comments indicates you're misunderstanding someth
More