Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63634
| From | Christopher Welborn <cjwelborn@live.com> |
|---|---|
| Subject | Re: Constructive Criticism |
| Date | 2014-01-09 14:54 -0600 |
| References | <8574fa07-af12-4e62-9cbc-3bd00802b6e2@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5286.1389300899.18130.python-list@python.org> (permalink) |
On 01/08/2014 11:56 PM, jeremiahvalerio123@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 <cjwelborn@live.com>
http://welbornprod.com
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Constructive Criticism jeremiahvalerio123@gmail.com - 2014-01-08 21:56 -0800
Re: Constructive Criticism Paul Pittlerson <menkomigen6@gmail.com> - 2014-01-08 22:06 -0800
Re: Constructive Criticism Ben Finney <ben+python@benfinney.id.au> - 2014-01-09 17:09 +1100
Re: Constructive Criticism jeremiah valerio <jeremiahvalerio123@gmail.com> - 2014-01-08 22:16 -0800
Re: Constructive Criticism Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-09 07:03 +0000
Re: Constructive Criticism Peter Otten <__peter__@web.de> - 2014-01-09 10:56 +0100
Re: Constructive Criticism jeremiah valerio <jeremiahvalerio123@gmail.com> - 2014-01-09 12:08 -0800
Re: Constructive Criticism Christopher Welborn <cjwelborn@live.com> - 2014-01-09 14:54 -0600
Re: Constructive Criticism jeremiah valerio <jeremiahvalerio123@gmail.com> - 2014-01-09 13:05 -0800
Re: Constructive Criticism Alister <alister.ware@ntlworld.com> - 2014-01-10 08:56 +0000
Re: Constructive Criticism jeremiah valerio <jeremiahvalerio123@gmail.com> - 2014-01-10 12:26 -0800
Re: Constructive Criticism Chris Angelico <rosuav@gmail.com> - 2014-01-11 07:34 +1100
Re: Constructive Criticism Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-10 21:24 +0000
csiph-web