[英]statement that executing code over and over [duplicate]
我不知道如何编写一遍又一遍执行的代码。 我想实现这样的事情:(<代表输入,>代表输出)
message=input()
print('Write down the text.')
>Write down the text.
<qwerty
>qwerty
>Write down the text.
<asd
>asd
您可以通过
while True:
// code you want to execute repeatedly here
while 循环将继续执行直到条件变为假(在这种情况下它永远不会)所以如果/当你想跳出循环时你需要使用break
语句
你是说这样吗?
while True:
message=input("Write down the text: ")
print(message)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.