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 - [email protected]
http://mail.python.org/mailman/listinfo/tutor