[Tutor] Creating Adventure Games Python Port - Chapter 2

Will Shattuck willshattuck at gmail.com
Mon Oct 2 05:06:38 CEST 2006

On 10/1/06, John Fouhy <john at fouhy.net> wrote:
> On 02/10/06, Kent Johnson <kent37 at tds.net> 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 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.

More information about the Tutor mailing list