[Tutor] Coin Flip

realNewbie dilisamom at yahoo.com
Fri Oct 3 20:04:22 CEST 2008

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
while count <101:
   randomFlip = random.randrange(0,1)
if randomFlip == 0:
    heads = heads + 1
    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.

More information about the Tutor mailing list