+ 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.
3 Antworten
+ 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.
+ 1
have a look at the time module, sleep is in there.
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?