Newbie Program

Eric seaeric at gmail.com
Fri Aug 5 01:09:53 EDT 2005


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



More information about the Python-list mailing list