Daniel Veazey
  • Home
  • About
  • Contact
  • What People Are Saying
Follow

Keep it simple

Apr16
2010
1 Comment Written by Daniel Veazey

There is another, simpler, easier way to do what I did in yesterday’s post. It’s another function of the time module, and it’s called “sleep.” You can put the statement “time.sleep(1)” and the number in the parentheses is how many seconds Python will wait before continuing with the program. So what took eight lines of code yesterday takes only five lines of code today:

countdown2.py   
  1. import time
  2. for count in range (30, 0, -1):
  3. print count
  4. time.sleep(1)
  5. print "boom."

I like it when I learn stuff. Comments are appreciated.

Be Sociable, Share!
  • Tweet

Related posts:

  1. Python, in bitesize chunks
  2. WP-SynHighlight
  3. Programming with Python
  4. Practical programming
  5. The Monty Hall Problem
Posted in Python - Tagged countdown, Python, sleep, time
SHARE THIS Twitter Facebook Delicious StumbleUpon E-mail
← Python, in bitesize chunks
YouTube →

1 Comment

  1. Jenita's Gravatar Jenita
    July 9, 2011 at 7:17 pm | Permalink

    These topics are so cnoufinsg but this helped me get the job done.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Categories

  • Activities
  • Audacity
  • Books
  • Film reviews
  • Free stuff
  • Gadgetry
  • Gimp
  • Inkscape
  • Jokes
  • Kdenlive
  • Linux
  • Music
  • Photography
  • Python
  • Quotes
  • Ukulele
  • Videos
  • WordPress

Why you should leave a comment

1. I read all the comments.
2. I reply and answer every question.
3. I always click through to see the sites of commentators.
4. Because you can.
5. You become a participant instead of just an observer.

Pictures I took

guy2 dsc_9494 DSC_0175 A Man And His Dog dsc_9462 girl2 DSC_0185 DSC_0179 sunset-trees Red Red Robin Busted panorama

Blogroll

  • A Life Ended Here
  • Arthur Reeder
  • Barrel House Marketing Group
  • Central Arkansas Innovative Alliance
  • Digital Photography School
  • Fazed
  • Freedom Feens Podcast
  • Full Circle Magazine
  • heathenx.org
  • John LeMasney
  • Libertarian Punk
  • Mitch Canter
  • Ozarks Unbound
  • radio free python
  • Ronnie Tucker
  • Tammy Hart Designs
  • The Agitator
  • Ubunite
  • Ubuntu
  • WordCamp Fayetteville
  • WP Beginner

EvoLve theme by Theme4Press  •  Powered by WordPress Daniel Veazey
Things I find interesting