Code executed after time | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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