Random number help

Achilleas Michailidis achmichael at gmail.com
Wed Nov 23 14:34:26 EST 2016


> You can use a while statement until you get a number out of your 
> excluded numbers
> 
> excludedNumbers = [1,2,3,4]
> randomNumber = random.randomint(1,100)
> 
> while randomNumber in excludedNumbers:
> 	randomNumber = random.randomint(1,100)
> 
> After the while you have a number outside the excluded numbers






More information about the Python-list mailing list