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

Kent Johnson kent37 at tds.net
Thu Sep 17 05:19:39 CEST 2009


On Wed, Sep 16, 2009 at 6:43 PM, Laurii <the_only_katala at verizon.net> 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 take the 25 and place it in "number".

time.localtime().tm_sec will give you the number of seconds as an
integer without any conversions.

Kent


More information about the Tutor mailing list