> Subject: Re: [Tutor] 6 random numbers
> From: shanta...@gmail.com
> Date: Mon, 17 Oct 2011 01:53:18 +0530
> CC: tutor@python.org
> To: kellyadr...@hotmail.com
> 
> On 17-Oct-2011, at 1:13 AM, ADRIAN KELLY wrote:
> 
> > hello all,
> > anyone know how i would go about printing 6 random numbers, i know i could 
> > copy and paste 6 times (which would work) but i was thinking about a while 
> > loop, ie. while lottery_numbers.count is <7. 
> > Is it possible to code this? is it possible to count random variables? i am 
> > trying to keep the program as simple as possible, cheers
> > 
> > any help would be welcome, 
> > 
> > import random
> > lottery_numbers=random.randrange(1,42)
> > print lottery_numbers
> > 
> 
> Following example may be useful:
> x = [random.randrange(1, 1+random.randrange(42) for _ in range(100)]
> 
> Useful read: 
> http://docs.python.org/tutorial/datastructures.html
> 
> -- 
> shantanoo
> http://xkcd.com/221/
> 
                                          
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to