> =
> import random
>
> coin1 = 0
> coin2 = 0
>
> coin1 = random.randint(1, 10)
> coin2 = random.randint(1, 10)
>
> if coin1 <= 5:
> print "Coin1 is Heads"
> else:
> print "Coin1 is Tails"
>
> if coin2 <= 5:
> print "Coin2 is Heads"
> else:
> print "C
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', 'ta
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 r
Dick Moores wrote:
> Works fine, but instead of
> coin1 = random.randint(1, 10)
> coin2 = random.randint(1, 10)
>
> you could simplify by using
> coin1 = random.randrange(2)
> coin2 = random.randrange(2)
or maybe random sample:
In [22]: random.sample(('heads', 'tails'), 1)[0]
Out[22]: 'tails'
Ke
At 04:38 PM 10/1/2006, Will Shattuck wrote:
>Hi all,
>
>I thought that it would be a great idea to learn Python while porting
>the BASIC code from this book. So I printed all the pages, have them
>"bound" by a big binder clip, and read through the first bit.
>
>In Chapter 2 there is a type of "Cho
Hi all,
I thought that it would be a great idea to learn Python while porting
the BASIC code from this book. So I printed all the pages, have them
"bound" by a big binder clip, and read through the first bit.
In Chapter 2 there is a type of "Choose Your Own Adventure" type
section. Since I didn