for循环
for i in range(10): if i >= 5: print(i) else: #break 跳出本层循环 continue #跳出本次循环 print("-----")
for i in range(10): print(i) if i== 5: break else: #当循环正常结束时,走else print("done")
while循环
count = 0 while True: print("你是风儿我是沙,缠缠绵绵到天涯...",count) count +=1 if count == 100: break
跳出多层循环#跳出多层循环,while、for、if都有else分支,循环完才执行else
for i in range(3): for j in range(3): if i==j==1: break else: print(i,j) else: continue break
,,,
结果为
0 0
0 1
0 2
1 0
'''