Re: beginner code problem

2006-06-02 Thread RJ
Thanks for all the help and examples. As I mentioned, I'm trying to teach myself and starting with the basics (if, elif, else, while, for, raw_input, int are about all I know so far and don't know that well yet) Some of the example posted are still beyond my understanding but it's good to see oth

Re: beginner code problem

2006-06-02 Thread Rene Pijlman
RJ: >import random >flip = random.randrange(2) >heads = 0 >tails = 0 >count = 0 >while count < 100: > if flip == 0: > heads += 1 > else: > tails += 1 > count += 1 Since flip isn't changed in the loop, this is going to report 100 heads or 100 tails, dep

Re: beginner code problem

2006-06-02 Thread Rob Johnson
On 2006-06-02 19:25:28 -0400, John Machin <[EMAIL PROTECTED]> said: > Thanks for the reply John. I seem to be getting all the same problems > with your code that I had with mine so it may be an issue with Python > on this computer though I haven't had one prior to now. I'm running it > on OSX T

Re: beginner code problem

2006-06-02 Thread DaveM
On Fri, 2 Jun 2006 18:41:53 -0400, RJ <[EMAIL PROTECTED]> wrote: > I'm trying to teach myself Python (probably running into the old dog >new tricks issue) and I'm trying to start with the very basics to get a >handle on them. > > I'm trying to write code to get the computer to flip a coin 100

Re: beginner code problem

2006-06-02 Thread Schüle Daniel
Hello > Here's the code I wrote: > > import random > > flip = random.randrange(2) > heads = 0 > tails = 0 > count = 0 > > while count < 100: > > if flip == 0: flip never changes again it's not reassigned in the while loop > heads += 1 > > else: > tails += 1 >

Re: beginner code problem

2006-06-02 Thread John Machin
On 3/06/2006 8:41 AM, RJ wrote: > I'm trying to teach myself Python (probably running into the old dog > new tricks issue) and I'm trying to start with the very basics to get a > handle on them. > > I'm trying to write code to get the computer to flip a coin 100 times > and give me the output

beginner code problem

2006-06-02 Thread RJ
I'm trying to teach myself Python (probably running into the old dog new tricks issue) and I'm trying to start with the very basics to get a handle on them. I'm trying to write code to get the computer to flip a coin 100 times and give me the output of how many times heads and tails. After