Newbie: Help Figger Out My Problem

ChuckDubya at gmail.com ChuckDubya at gmail.com
Tue Jun 28 09:23:30 CEST 2005


##Coin Flip: randomly flips 100 "coins" and prints results
##Original draft: june 27, 2005
##Chuck

import random
heads = 0
tails = 0
flips = 0
while flips < 99:
        coin = random.randrange(0, 2)
        if coin == 0:
            heads = heads + 1
        else:
            tails = tails + 1
        flips = flips + 1
if flips >= 99:
        print "Heads: " + heads
        print "Tails: " + tails
        print "Total: " + flips + "flips"
raw_input("Press the enter key to exit.")



When I save and run this "program", I get a DOS window that flashes at
me and disappears.  What's wrong with it?




More information about the Python-list mailing list