General Question

intro24's avatar

Creating a countdown script in Python...

Asked by intro24 (1434points) October 26th, 2007
2 responses
“Great Question” (0points)

anybody know how to add a countdown function to python. Like if I wanted to make a program sleep for some time then continue

Observing members: 0
Composing members: 0

Answers

FusionGyro's avatar

import time
time.sleep(10) # sleep for ten seconds

sferik's avatar

# Say 3, 2, 1, Happy Birthday!
import time
i = 4
for j in range(1, i):
  print i - j
  time.sleep(1)
else:
  print "Happy Birthday!"

Answer this question

Login

or

Join

to answer.

Mobile | Desktop


Send Feedback   

`