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 program is used to be the number. (i.e. if the clock on your computer says 7:35:25 then it would take the 25 and place it in "number".


You can either use:

import time
number = int(time.strftime("%S"))

or use real pseudo-random numbers:

import random
number = random.randint(0,59)

The latter looks clearer to me.

- Patrick
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to