我需要每10秒打印一次句子“Hello World”。但是,如果用户输入'c'或'Enter'键,则程序应停止打印该句子并提示用户提供另一个句子。检查用户提供的句子,如果该句子包含任何数字,则显示消息:“不能包含数字”。否则显示消息:“正确的句子”。在显示任一消息之后,程序继续打印“Hello World”。
以下是我开始的代码。非常感谢您对如何进一步继续的任何提示。 谢谢!
```python import time while True: print("Hello World") time.sleep(10) ```
以下是我开始的代码。非常感谢您对如何进一步继续的任何提示。 谢谢!
```python import time while True: print("Hello World") time.sleep(10) ```
import threading
def looping():
threading.Timer(10.0, looping).start()
print("Hello World!")
looping()