Keep it simple


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:

  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.

Related posts:

  1. Python, in bitesize chunks
  2. Programming with Python
  3. WP-SynHighlight
  4. The bike saga continues
  5. Practical programming

One thought on “Keep it simple

Leave a 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>