+ 1
How do you give delay in ur code (Python)
Im new to scripting and i wanted to make a code but i don't know how to add delay please help me out
3 Answers
+ 5
# Hi Ties van Asten !
# Like this:
import time
msg = 'Hello world!'
for c in msg:
print(c, end=' ')
time.sleep(0.2)
print()
# āHello world!ā Will be printed, one character at time, with 0.2 seconds
# (and a extra space) between them.
# But unfortunately, you will not see the effect here on SoloLearns
# Playground. So try it somewhere else.
+ 2
Have to do this on my terminalš
import time
import sys
msg = "Hello world!"
while True:
for c in msg:
sys.stdout.write(c)
sys.stdout.flush()
time.sleep(0.15)
print()
time.sleep(1.5)
+ 1
Import module time (import time) and use time.sleep(x)
X = Delay