[Tutor] (no subject)

Pierre Dagenais pierre.dagenais at ncf.ca
Wed Oct 1 22:15:37 CEST 2008


kayla bishop wrote:
> ok i imported the random module and set it up with a 2... i can't get it to loop correctly to where it keeps going until the total of heads and tails is 100> Date: Wed, 1 Oct 2008 00:18:51 -0400> From: pierre.dagenais at ncf.ca> CC: tutor at python.org> Subject: Re: [Tutor] (no subject)> > kayla bishop wrote:> > I can't figure out how to write a program where you flip a coin 100 times and it keeps track of how many heads and tails you flipped but it has to be random. Can you please help> > 
Hi Kayla,
Have you read the other posts on the list? bhaaluu sent you a great 
little tutorial showing how a pro would go about solving this problem. 
Read it carefully, it's really worth all the time you will spend on it. 
Your problem seems to be that you expect the random module to return a 
100 answers, it won't. Random returns only one choice for everytime you 
run it. That's why we use a loop, to run random a 100 times.
Don't despair, in the beginning everybody trips on silly details like 
that, keep at it and soon you'll be the expert.

Kent,
I didn't realize the list had a policy, I'm sorry for breaking it. Were 
can I read it? ignorance not being an excuse.


More information about the Tutor mailing list