advice on this little script
James Stroud
jstroud at ucla.edu
Wed Mar 8 23:14:06 EST 2006
John Salerno wrote:
> My first project when I started learning C# was to make a little timer
> to tell me when my laundry was done :) and I thought it would be fun to
> convert this to Python. Here's what I came up with after much struggling
> with the Timer class from the threading module -- as you can see, I
> abandoned it for the sleep() function from timer.
>
> Please let me know if this is a good (i.e. Pythonic) way of doing this,
> and if it can be improved (although I don't need anything fancier than
> this basic functionality).
> ---------------------
> from time import sleep
>
> minutes = input('Enter the number of minutes to wait: ')
>
> for x in range(minutes):
> sleep(1.0)
> minutes -= 1
> print minutes, 'minutes remaining.'
> ---------------------
Very nice, but maybe
...
sleep(60.0)
This corrects for the number of seconds in a minute.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
More information about the Python-list
mailing list