3 ms·
I think the final output of a simple solution to your last question can always be just four lines. def bar(baz): baz() baz() bar(bar(b
by endtime 16y ago
I think the final output of a simple solution to your last question can always be just four lines.
def bar(baz):
baz()
baz()
bar(bar(bar(bar(foo)))) and bar(bar(foo)) and foo()
for N=21, for example. Actually, you can make it two lines if your goal is really to minimize LOC:
def bar(baz): baz() and baz()
bar(bar(bar(bar(foo)))) and bar(bar(foo)) and foo()
- endtime 16y agoWhoops, `baz() and baz()` actually doesn't work, because foo may not return a truthy value (and bar definitely doesn't). One fix, which actually makes it even shorter, is just `baz(), baz()`. Same goes for `bar(bar(...)) and bar()`; all the `and`s should be commands instead in my solution above. Of course, this is Python-specific.
- endtime 16y agos/commands/commas/g