Hello- I am running Python v 3.1.1. As an exercise, I wrote a simple coin flipper program, where the computer flips a coin 100 times and then prints out the number of heads and tails. My program crashes immediately if I run it normally through the command line, but if I go to "Run- Run Module," it seems to work just fine. I can't seem to figure out why. I've pasted the relevant code below- any help will be greatly appreciated. Thanks!
import random print("\tWelcome to the 'Coin Flipper' program!") counter = 0 heads = 0 tails = 0 while counter < 100: the_number = random.randint(1, 2) if the_number == 1: heads += 1 else: tails += 1 counter += 1 print("\nI flipped the coint 100 times.") print("It came up heads", heads, "times and tails", tails, "times.") print("\n\nPress the enter key to exit.") _________________ -Alex
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor