[Tutor] New programmer, need some help getting started on my first project

johnf jfabiani at yolo.com
Fri May 19 01:45:43 CEST 2006


On Thursday 18 May 2006 16:19, Chris Delgado wrote:
> import random
>
> heads = 0
> tails = 0
> flips = 0
>
> if flips <= 100:
>
>     coin = random.randrange(2)
>
>     if coin = 0:
>         heads +=
>     elif coin = 1:
>         tails +=
>
>     flips +=1
>
> print "The coin was flipped 100 times and it was heads" + heads + "times
> and tails" + tails + "times!"
>
> raw_input("\n\nPress the Enter key to exit")

I think you want '==' and not '='.  Look up assignment and equal!
John


More information about the Tutor mailing list