Le Fri, 4 Feb 2005 12:49:51 -0600, Chad Everett a écrit :
> 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 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
elif tries == 2: # should be better
> tails = 1
> count += 1
>
> print "heads: " + heads
> print "tails: " + tails
>
> raw_input("Press enter to quit")
>
>
--
http://mail.python.org/mailman/listinfo/python-list