Sometimes we need a delay between the execution of two instructions. Python has inbuild support for putting the program to sleep. The time module has a function sleep(). Here is an example to use sleep().
import time
print("hello")
time.sleep(1.2) # sleep for 10=.2 sec
print("world)
For adding time delay in the loop
import time
text="hello world"
for i in text:
print(i)
time.sleep(5)
Using asyncio.sleep() function
import asyncio
print("Hello world")
async def display():
await asyncio.sleep(5)
print("Time sleep added")
asyncio.run(display)
Using Timer
from threading import Timer
print('Hello world')
def display():
print('Timer used')
t = Timer(5, display)
t.start()