Print statement with a timer

is there a way to create a print statement that doesn’t print instantly but prints with a few seconds delay.
like suppose i have four print print statements and i want to print each statement with a 10 second interval. How should i do that?
maybe datetime module can come in handy?

The simplest way is to use the sleep() method. To use it, the time module must be imported (and the fist argument i:t accepts is time in seconds)

import time
print("Hello")
time.sleep(3)
#will "sleep" for 3 seconds
print("World!")
#will print:
>>Hello
#3 second delay
>>World!

I hope this helps!

1 Like

Thanks this was just what i was looking for .

1 Like