Re: [Tutor] Using the TIME module to extract a semi-random number

2009-09-19 Thread Kent Johnson
On Sat, Sep 19, 2009 at 12:24 AM, Katt wrote: > One last question on the TIME module: Is there one version of these examples > that is not portable to other systems?  I read something about some > functions not working on other systems and I would like to ensure that the > programs that I write a

[Tutor] Using the TIME module to extract a semi-random number

2009-09-18 Thread Katt
- Original Message - Message: 1 Date: Wed, 16 Sep 2009 23:19:39 -0400 From: Kent Johnson To: Laurii Cc: tutor@python.org Subject: Re: [Tutor] Using the time module to extract a semi-random number Message-ID: <1c2a2c590909162019l364b516cifcd2e0befe2ad...@mail.gmail.com> Conten

Re: [Tutor] Using the time module to extract a semi-random number

2009-09-18 Thread Kent Johnson
On Thu, Sep 17, 2009 at 4:59 PM, Katt wrote: > > - Original Message - From: "Kent Johnson" >> time.localtime().tm_sec will give you the number of >seconds as an >> integer without any conversions. > > Thank you for your quick response.  I didn't expect to get a response for a > couple of

Re: [Tutor] Using the time module to extract a semi-random number

2009-09-17 Thread Alan Gauld
"Patrick Sabin" wrote import random number = random.randint(0,59) The latter looks clearer to me. Me too, but if the object is to get the learner using the time module it doesn't help! :-) But if the object is really to get a random number then its much better... Alan G. __

Re: [Tutor] Using the time module to extract a semi-random number

2009-09-17 Thread Patrick Sabin
Laurii wrote: Hello all, I am currently reading through the Tutorial for Non-Programers by Josh Cogliati. I have had great success until now. The exercise to modify a number guessing program from a fixed number "number = 78" to using the time module and use the seconds at the time the prog

Re: [Tutor] Using the time module to extract a semi-random number

2009-09-16 Thread Kent Johnson
On Wed, Sep 16, 2009 at 6:43 PM, Laurii wrote: > The exercise to modify a number guessing program from a fixed number "number > = 78" to using the time module and use the seconds at the time the program > is used to be the number. (i.e. if the clock on your computer says 7:35:25 > then it would t

Re: [Tutor] Using the time module to extract a semi-random number

2009-09-16 Thread Mal Wanstall
Hi Katt, The following does the trick for me: number = int(time.strftime("%S", time.localtime())) There may be better ways to do it though. -Mal On Thu, Sep 17, 2009 at 8:43 AM, Laurii wrote: > Hello all, > > I am currently reading through the Tutorial for Non-Programers by Josh > Cogliati.  

[Tutor] Using the time module to extract a semi-random number

2009-09-16 Thread Laurii
Hello all, I am currently reading through the Tutorial for Non-Programers by Josh Cogliati. I have had great success until now. The exercise to modify a number guessing program from a fixed number "number = 78" to using the time module and use the seconds at the time the program is used to