57
Awesome Team
Vedran Čačić
https://web.math.hr/~veky
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.
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
Interesting approach. I know why it's fast, but I wouldn't believe it's _so much_ faster.
It seems we have another "optimization anecdote". ;-)
More
Yes, it's fast. But I wouldn't call it "simple". You have duplicated code fragments at two places in the code, leading you to name lambdas - which is not as bad as PEP8 makes it seem, but still can be avoided.
First one is easy:
if day != current_day:
current_day = day
total +=
More
Hmm...
(letter.isblah() for letter in data) ~~~> map(str.isblah, data) [call it `contains`]
And that `if not somecond: return False` is much clearer written as just `return somecond`.
return len(data) < 10 and contains(str.isupper) and contains(str.islower) and contains(str.isdigit)
More
Why `k` and `p`? And while we're at it, why `o` and `l`? :-O
More
And what do I do now? Give 4 stars to the first one, and 2 stars to the second? :-P
More
That max with 0 seems really ugly in a Clear solution... having another if would be too much for you? :-)
More
The same as [Aperiodic](https://py.checkio.org/mission/periodic-table/publications/veky/python-3/aperiodic/), only readable. :-D If you ever wanted to see how that one worked, but didn't have courage to tackle it. :-]
More
Again, obsession with lists. `merged` is the true solution, line 13 is just bureaucracy. :-)
More
What's the point of having a good solution in the docstring, and then an inferior one in the code?
More
`max` has a `default` keyword, too, which you can use to avoid lines 5 and 6.
Also, re's forward looking might help you so you don't have to extract `group(0)` as a separate operation.
More
Nice usage of 3D numpy array. But the initialization could really be more
compact... at least those dots after 0 and 1 shouldn't be there.
More