newbie: Syntax error

Chad Everett everettcc at hotmail.com
Fri Feb 4 13:49:51 EST 2005


Hi Everyone,

I am new to Python and programming in general.  I bought the book "Python
Programming for the Absolute Beginner" by michael Dawson.

I have been working through it but am having trouble.
I am trying to make a coin flip program and keep geting a Synax Error
"invalid syntax".

If anyone has a moment could you please look at it and tell me what I am
doing wrong.

thanks for your time and patience.

Chad

# Coin Flip Program
# This program flips a coin 100 times and tells the number of heads and
tails.
# Chad Everett 2/3/2005


print "\t\t********Coin Flip Game*********\n"
import random

# heads = 1
# tails = 2

tries = random.randrange(2) + 1
count = 1

while count != 100:
    if tries == 1:
        heads = 1
        count += 1

    else tries == 2:  # I AM GETTING THE SYNTAX ERROR HERE
        tails = 1
        count += 1

print "heads: " + heads
print "tails: " + tails

raw_input("Press enter to quit") 





More information about the Python-list mailing list