On 10/1/06, John Fouhy <[EMAIL PROTECTED]> wrote:
> On 02/10/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
> > or maybe random sample:
> > In [22]: random.sample(('heads', 'tails'), 1)[0]
> > Out[22]: 'tails'
>
> I think random.choice would be a better option here:
>
> >>> random.choice(['heads', 'tails'])
> 'tails'
> >>> [random.choice(['heads', 'tails']) for i in range(10)]
> ['tails', 'tails', 'heads', 'tails', 'tails', 'tails', 'heads',
> 'heads', 'heads', 'heads']
>

Thanks all.  My main intent is to keep it simple.  I may expand some
of these code samples into my own sort or tutorial on python.  Some
say that if you can teach something to others then you know that you
know the subject.

I'll research these out and pick what fits for me.  Thanks all :)

Will

-- 
Will Shattuck  ( willshattuck.at.gmail.com )
Home Page:  http://www.thewholeclan.com/will

When you get to your wit's end, you'll find God lives there.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to