Reputation: 1
I need to print out "Hello World" for 3.5 seconds.
import time
t_end = time.time() + 3.5
while time.time() < t_end:
print("Hello World")
After that time, another text should be printed out automatically for 3.5 seconds. How can I make an infinite loop here?
Upvotes: 0
Views: 39
Reputation: 11
You mean something like this?
import time
while True:
print("Hello world!")
time.sleep(3.5)
print("Hello again!")
time.sleep(3.5)
Upvotes: 1