Code executed after time | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Code executed after time

I want to make a statement end with “. . .” (Example: print(“Let’s play a game(dot)wait(dot)wait(dot)”)But have each dot wait a second before appearing, to give the program a little bit of life. How would I go about doing this? I tried using sleep but it doesn’t work for me.

2nd Oct 2019, 8:28 PM
Advanced Incognizant
3 Answers
+ 2
import time print("The statement you want to output", end='') for x in range(3): print('.', end='') time.sleep(1) # or you can swap the two line in the 'for' loop around.
2nd Oct 2019, 9:05 PM
rodwynnejones
rodwynnejones - avatar
+ 1
have a look at the time module, sleep is in there.
2nd Oct 2019, 8:36 PM
rodwynnejones
rodwynnejones - avatar
0
rodwynnejones When I try time.sleep(1),”.”, time.sleep(1),”.”, time.sleep(1),”.” It prints out “None . None . None .” What am I doing wrong?
2nd Oct 2019, 8:45 PM
Advanced Incognizant