while语句及练习题

循环

1.死循环:永远循环

while 1==1:

  print("ok")     #程序会一直执行,出不来

2.解决死循环的问题

count=0
while count<1:
    print("fuck")
    count=count+1
print('123')

3.练习题及答案

(1)使用while输入 1 2 3 4 5 6  8 9 10

猜你喜欢

转载自www.cnblogs.com/yxzymz/p/12704387.html