Norman Khine wrote:
On Mon, Apr 27, 2009 at 12:07 AM, Sander Sweers <sander.swe...@gmail.com> wrote:
Here is another one for fun, you run it like
python countdown.py 10

#!/usr/bin/env python

import sys
from time import sleep

times = int(sys.argv[1]) # The argument given on the command line

def countdown(n):
    try:
        while n != 1:
            n = n-1
            print n
            sleep(1)
    finally:
        print 'Blast Off!'

countdown(times)

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to