break终止当前循环,跳出循环体
a="unics" answer=input("一句话:") while True: if answer==a: break answer=input("再次输入:") print("答对了")
#continue终止本轮循环,并执行下一轮循环
for i in range(4): if i==2: print(‘前‘,i) continue print(‘后‘,i)
时间: 2024-11-06 03:37:36
break终止当前循环,跳出循环体
a="unics" answer=input("一句话:") while True: if answer==a: break answer=input("再次输入:") print("答对了")
#continue终止本轮循环,并执行下一轮循环
for i in range(4): if i==2: print(‘前‘,i) continue print(‘后‘,i)