General Question

intro24's avatar

Creating a countdown script in Python...

Asked by intro24 (1434points) October 26th, 2007

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

2 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.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther