Newbie: Help Figger Out My Problem
ChuckDubya at gmail.com
ChuckDubya at gmail.com
Tue Jun 28 03:23:30 EDT 2005
More information about the Python-list mailing list
Tue Jun 28 03:23:30 EDT 2005
- Previous message (by thread): Newbie: Help Figger Out My Problem
- Next message (by thread): Newbie: Help Figger Out My Problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
##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?
- Previous message (by thread): Newbie: Help Figger Out My Problem
- Next message (by thread): Newbie: Help Figger Out My Problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list