0

Python : Breaking nested loop

For you, what is the most elegant manner to break the nested loop, with 2 levels deep or more ? Many thanks for your time regards EG

22nd Feb 2021, 12:03 AM
RikoG
1 Resposta
+ 1
for x in range(10): for y in range(10): for z in range(10): print(x,y,z) if x*y*z == 30: break else: continue break else: continue break
22nd Feb 2021, 12:18 AM
visph
visph - avatar