Y
Hacker News
new
|
ask
|
show
|
jobs
by
Mikhail_Edoshin
942 days ago
It is actually much simpler: you change 'n' as well:
while i < n: if shouldDelete(iterable[i]): del iterable[i]; n -= 1 else: i += 1