Since the variable *count* never increases inside of the loop body, it gets stuck in the *while* loop.
I recommend taking a hard look at the program, consider what it should be doing, and then seeing which statements should be in the *while* loop, and which ones should be outside it. Tony R. On Fri, Oct 3, 2008 at 2:04 PM, realNewbie <[EMAIL PROTECTED]> wrote: > > This is a class assignment, I am to create a program that flips a coin 100 > times and tells me the number of heads and tails. > I've been working on it for 2 days now and I am stuck. I a trying to run > the > program but it is not running. > Can someone please point out my error? > > Here is what I have come up with: > import random > heads=0 > tails=0 > count=1 > while count <101: > randomFlip = random.randrange(0,1) > if randomFlip == 0: > heads = heads + 1 > else: > tails = tails + 1 > count = count + 1 > print heads," heads" > print tails," tails" > -- > View this message in context: > http://www.nabble.com/Coin-Flip-tp19802888p19802888.html > Sent from the Python - tutor mailing list archive at Nabble.com. > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor >
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor