+ 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

27th Nov 2022, 12:18 PM
Ties van Asten
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.
27th Nov 2022, 12:36 PM
Per Bratthammar
Per Bratthammar - avatar
+ 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)
27th Nov 2022, 3:13 PM
Lochard
Lochard - avatar
+ 1
Import module time (import time) and use time.sleep(x) X = Delay
28th Nov 2022, 5:16 PM
Name
Name - avatar