(I asked this question in chat several months ago, but reposting it as a question so I can find the answer easier in the future.)
I’ve got a Python loop which I want to continue three times if a condition is met. How can I do so? Example:
<code>for i in range(1, 10):
if i == 4:
i += 3
continue
print(i)
</code>
<code>for i in range(1, 10):
if i == 4:
i += 3
continue
print(i)
</code>
for i in range(1, 10):
if i == 4:
i += 3
continue
print(i)
This naive code produces 1, 2, 3, 5, 6, 7, 8, 9
, but the desired output is 1, 2, 3, 7, 8, 9
.