Hi so I'm creating a text-based game with Python and I want to make it so that before each print statement there is a one second delay.
My current solution is to do this:
time.sleep(1)
name = input('Do you happen to remember what your name was? ').capitalize()
print(name + ", that's a nice name.")
time.sleep(1)
print("Well it seems that you are all better now so I'm going to have to let you go")
However, it is annoying to put a time.sleep
before each print!
So I'm wondering if anyone knows a more efficient way of doing this.
why not use function to do it?
def dprint(s, delay=1):
time.sleep(delay)
print(s)
Is it ok for you?
dprint("hello")