[Tutor] Coin Flipping Program

xDog Walker thudfoo at gmail.com
Sun Aug 21 18:38:45 CEST 2011

On Sunday 2011 August 21 09:14, Joel Preston wrote:
> Hello Programmers,
> I am trying to learn Python on my own through a book called "Python
> Programming for the Absolute Beginner".  I am stuck on a challenge at the
> end of a chapter and I am hoping for a little help.
> The challenge is to write a program that flips a coin 100 times and tells
> you the number of heads and tails that come up.  So far I can write a
> program that will flip a coin 100 times but it will only come up tails or
> heads all 100 times.  I have been stuck on this for about 3 days now.  I
> have attached the program and am hoping for some advice.

Move coin = random.randint(1, 2) inside the "flipping loop".
I have seen the future and I am not in it.

More information about the Tutor mailing list