57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
Last seen 12 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.
Inspired by [this](https://py.checkio.org/mission/funny-adding/publications/andrea.manno1/python-3/string_addition/#comment-49362).
More
The goggles, they do nothing! :-o
Also, see [this](https://py.checkio.org/mission/colder-warmer/publications/veky/python-3/parentheses/share/ddd4befd4b0caa50d7008f47d3c64640/#comment-5463) comment as a demotivational poster. :-D
More
Wasn't it better, since you already made a copy in line 2, to destroy the copy (lines 7 and 10) than the original argument? :-)
More
> Do not understand how it done
Then how did you write it? :-)
Especially I'm interested in that list(zip(...)) thing. I'm talking about exactly that in one of my VCRs. ;-]
Also, didn't it occur to you to write just _one_ operation, and then iterate it in a loop instead of madly copy-pasting code
More
Doesn't this duplication bother you? :-)
Also, `def min(*args, key=lambda x:x):`.
And saving one line just to assign min_item to min_item is not a gain. Rather bite the bullet and write `if key(item) < key(min_item): min_item = item` in one line if you really don't want to use another line.
More
What's the contest: how to write it using a maximal number of lines? :-D
More
For understanding of what? Most convoluted way to solve this task? :-P
Decorate-Sort-Undecorate is so 20th century. :-P
More
If anyone wondered how it's possible to write LISP in Python, I'll show them your code. :-P
The whole point of Python's readability is that it pulls out some very frequent functional patterns and gives them standard names (slicing, sum, operators, comprehension...). By writing them back into the "r
More
I don't like CamelCase. Luckily Python has a style guide. :-P
A much more important question: why does a new programmer use Python 2?
More
Ok, let's say you didn't know how to generate sets in less than 15 lines. But should I seriously believe that you thought it's better to compare sets with [XNOR](https://en.wikipedia.org/wiki/XNOR_gate) than with simple `==`? :-P
More
Ok, this looks better. But can be improved a lot.
First, you don't need so many parentheses. Last line, return doesn't need them:
return tally(first_word) == tally(secod_word)
Second, not only lists can be comprehended: sets can, too.
return {(letter, word.count(letter)) for letter in wo
More
It's funny that without parentheses around if/else expression it would be more natural and more readable. :-)
Also, 0 before : and len() around array can be dropped.
More
That 999 is so ugly and error-prone. Why not
from math import inf
? :-)
More
Actually, you need a *string comprehension*. :-D
c"y * (x=='X') for x, y in zip(cipher, password)"
Because Guido will not give you one since he values his sanity, next best thing is to call `''.join` something more meaningful. Just to spite Guido (see last question [here](http://www.artima.com
More
Hmm... let's see your iteration in more detail. :-)
First, you can use parentheses for grouping, you don't need another line.
for i, (mask, text) in enumerate(zip(l1, l2)):
Second, since you already know the length, it might be easier to flatten it. Flat is better than nested, after all. ;-)
More