On 01/08/2014 11:56 PM, jeremiahvalerio...@gmail.com wrote:
Hi, hows it going I've been self teaching myself python, and i typed up this 
small script now i know its not the best the coding is not the best but i would 
like to know of ways to make a small script like this better so all 
constructive critisim is Welcome.



Here is the link to the code

    " http://pastebin.com/5uCFR2pz "


I'm not sure if someone already pointed this out, but imports only need
to be done once. Usually at the beginning of the file, but not always.
In your case I would say yes, at the beginning.

import sys
import time

def countdown(seconds):'
    # start at 'seconds' and count down with a for-loop
    for i in range(seconds, 0, -1):
        # print the current second (i)
        print('closing in {} seconds.'.format(i))
        # sleep for one second (no need to import time again).
        time.sleep(1)

# Example usage:
print('hello')
# Prints the countdown.
countdown(10)
sys.exit(0)
--

- Christopher Welborn <cjwelb...@live.com>
  http://welbornprod.com

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to