Comment

Comment by magnusmundus

> This works all the time and serves all possible cases.

Unless you want the check to be always against the initial length of your iterable, rather than its modified state, you'd have to repeat the `n = len(iterable)` inside the loop, or introduce some syntactic caramel of the walrus kind (though I'm not sure if it would work here).

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton