关键词while
while True:
print ("Hello world")
开始运行,系统就会一直输出Hello world,一直死循环,要让它停下来只能终止运行,很不方便,所以我们结合之前所学的知识把它修改一下
a = int(input("请输入你要循环的次数:"))
while a:
print ("hello world")
a = a - 1
这样一来,你输入的是几,系统就会循环几次,这下就好多了。
关键词while
while True:
print ("Hello world")
开始运行,系统就会一直输出Hello world,一直死循环,要让它停下来只能终止运行,很不方便,所以我们结合之前所学的知识把它修改一下
a = int(input("请输入你要循环的次数:"))
while a:
print ("hello world")
a = a - 1
这样一来,你输入的是几,系统就会循环几次,这下就好多了。