[Tutor] Generate 8 digit random number
Kent Johnson
kent37 at tds.net
Fri Aug 26 16:00:50 CEST 2005
Alberto Troiano wrote:
> Hi everyone
>
> I need to generate a password..It has to be an 8 digit number and it has to
> be random
>
> The code I've been trying is the following:
>
>
> import random
> random.randrange(00000000,99999999)
>
> The code works but sometimes it picks a number with 7 digits. Is there any
> way that I can tell him to select always a random number with 8 digits?
random.randrange(10000000,99999999) ??
Kent
More information about the Tutor
mailing list