Newbie Program

Devan L devlai at
Fri Aug 5 08:30:09 CEST 2005

Eric wrote:
> I am reading a book on Python and ran across and exercise that I just
> can't seem to figure out.  Its pretty simple, but I just can't get
> past a certain point.
> The task is to create a program that flips a coin 100 times and keeps
> track of the total of heads and tails which is printed to the screen.
> My plan was to use import random with a range of 2 and use a
> conditional statement to count to 100. The problem I am encountering
> is how do I keep track of the totals for heads and tails?
> Any suggestions would be appreciated. Keep in mind I am very new to
> Python so there may be a more sophisticated way, but I am just trying
> to use what the book has taught so far.
> Thanks,
> Eric

Someone else read the same book, I suppose.

More information about the Python-list mailing list