38
StefanPochmann
16 38 54 Leader of the month
8978/ 9195
Last seen 3 hours ago
Member for 9 years, 1 month, 4 days
Difficulty Normal
Recent solutions I'm happy with (just starting/trying this): [Words Order](https://py.checkio.org/mission/words-order/publications/StefanPochmann/python-3/short-dict-subsequence/share/5bbb2df54ec5a810d36d7f70ae7e92da/) Dang it no markdown here?

Best reviews / Newest reviews
list > str-StefanPochmann
[Why does naive string concatenation become quadratic above a certain length?](https://stackoverflow.com/q/44487537) More
packed with fun-veky 1
Now *that's* a stack. Inspired this silly thing. I don't really like it, but at least it uses `match` for actual *structural* matching (unlike all the other solutions I saw which only did `match item:`). And I do like my fifth case. ```python def postfix_evaluate(items): stack = () for item More
packed with fun-veky 1
And another solution further away but still inspired by yours: ```python from operator import add, sub, mul ops = {'+': add, '-': sub, '*': mul, '/': lambda x, y: y and x // y} def postfix_evaluate(items: list[int|str]) -> int: if op := ops.get(item := items.pop()): right = postfix_eva More
packed with fun-veky 2
Tadaa! Non-recursive top-down, and I'm actually loving this one. I don't even have to peel the result value off the stack at the end. ```python def postfix_evaluate(items: list[int|str]) -> int: stack = () for item in reversed(items): while True: match item, stack: More
Second-juestr 2
Doesn't work, for example returns `True` for `balanced_centrifuge(21, 10)`. More
First-freeman_lex
I want a button to hide all comments so I can read the code, without distractions :-P More
findall, pop()-kurosawa4434
I'm curious: Why AIOUE instead of AEIOU? More
get to the next stage-juestr 1
`isvowel = set("aeiouAEIOU").__contains__` seems more natural to me. Did you first use `dict.fromkeys("aeiouAEIOU", True).get` and then switched to `__contains__`? `"aeiouAEIOU".__contains__` also works, as does `"aeiouAEIOU".count` :-). But I think `set` is best. More
Second-StefanPochmann
Ugh, I just noticed that all lines are almost equally long, just one is one char too short and another is one char too long. Irritating. More
Top-down-StefanPochmann
If I'm not mistaken, everybody else worked bottom-up (i.e., `items` from left to right). Previously posted [a few other variants](https://py.checkio.org/mission/postfix-evaluation/publications/veky/python-3/packed-with-fun/share/8c79fa5a557ecd890f2b65385934c008/#comment-126213). More
First-juestr 1
Some variations (first one is yours, for easy comparison): ```python def beat_previous(digits: str, last: int=-1) -> list[int]: try: s, i = next((s, i) for s in accumulate(digits) if (i:=int(s)) > last) return [i] + beat_previous(digits[len(s):], i) except StopIteration: More
Convenience-StefanPochmann
Variation of my [original](https://py.checkio.org/mission/sequence-analyzer/publications/StefanPochmann/python-3/six/?ordering=most_voted&filtering=all), just adding helpers to make the actual solution cleaner. Yet another variation with the same helpers: ```python def analyzer(s): for j, c in More
LCM(1,2,3) = 6-StefanPochmann
Also posted a [variation](https://py.checkio.org/mission/sequence-analyzer/publications/StefanPochmann/python-3/convenience/#comment-126282) with easier translation between characters and numbers. More
Third-tokiojapan55 1
Haven't gotten wrong results from this is version, but some cases are extremely slow again, like `balanced_centrifuge(80, 77)` (119 seconds) and `balanced_centrifuge(98, 93)` (ran for about 7 minutes until it was killed, not sure why). More
1-liner with sympy and itertools-tamagoyaki 1
That looks right, although a bit slow. I might use `{*sympy.factorint(n), 0}`, I really dislike explicit `.keys()` calls. And you could make it faster by using `issubset` on an iterator instead of building the whole set of sums: ```python def balanced_centrifuge(n: int, k: int) -> bool: return More
First (reposted)-juestr 1
`return {k, n - k} <= allowed` would also work. Or without duplication: ``` need = {k, n - k} limit = max(need} ... return need <= allowed ``` More
mildm + min + max-StefanPochmann
Inspired by [@mildm's solution]( https://py.checkio.org/mission/longest-common-prefix/publications/mildm/python-3/first/share/bb6db9d7936b4e2875616378bc669731/). More
First-oleg.sidorov.ds
Hmm. `collatz_convert('uddudd')` returns `1`. I think it should be `None`, since the original forward-going Collatz sequence **stops** when 1 is reached, doesn't run extra cycles 1->4->2->1. More
First-imloafer 1
This one seems quite buggy. Some test cases (input, what I'd expect, and what you return): ``` 'u' None 0.0 'ud' None 0.3333333333333333 'du' None 0.0 'udu' None -0.3333333333333333 'udd' None 1.0 'dud' None 0.6666666666666666 'ddu' None 0.0 'udud' None -0.11111111111111112 'uddu' None -0.333333333 More
n % 6 == 4-veky 1
The criterion for 'u' looks like Chinese to me... More
1 2 3 4
5
6 7 8 9 10