[Tutor] 6 random numbers
robert.sjoblom at gmail.com
Mon Oct 17 13:35:57 CEST 2011
> print random.randrange(1,42)
> If you want to collect the intermediate results, either store them in a
> results = 
> for i in range(6):
Gmail has removed the "Reply All" function for some ABSOLUTELY
RIDICULOUS REASON, so I think people missed my reply on this.
randrange is a horrible way to generate lottery numbers because it
doesn't generate unique numbers, and as for lotteries I don't think
I've seen a single one where they put the balls back before selecting
a new. random.sample is better because it does (for this purpose, at
least) and it stores the result in a list automatically.
Let's hope this email goes to the right thread. :/
More information about the Tutor