Newbie Program

Devan L devlai at gmail.com
Fri Aug 5 02:30:09 EDT 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.

http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/87fcaf8ffbbd69e7/c7ff2d2b5b0d776d?q=coin+flip&rnum=3#c7ff2d2b5b0d776d




More information about the Python-list mailing list