I have 3 loops. I would like to when the innermost loop meets a specific condition, exit from 2 inner loops and continue the outer loop.
for i in range(0,3):
for j in range(0,4):
for k in range(0,5):
if k == 3:
break
print(i,j,k)
My output is :
0 0 0
0 0 1
0 0 2
0 1 0
0 1 1
0 1 2
1 0 0
1 0 1
1 0 2
1 1 0
1 1 1
1 1 2
but I would like to get to:
0 0 0
0 0 1
0 0 2
1 0 0
1 0 1
1 0 2