Random number help

Marko Rauhamaa marko at pacujo.net
Wed Nov 23 14:21:14 EST 2016


Thomas Grops <twgrops at googlemail.com>:

> random.randint(1,100) works as it will randomly pick numbers between 1
> and 100 but say i don't want 48 to come out is there a way of doing
> this. It needs to be an integer too so not a list unless there is a way
> to convert list to int

   r = 48
   while r == 48:
       r = random.randint(1, 100)


Marko



More information about the Python-list mailing list