[Tutor] Coin Flip

bhaaluu bhaaluu at gmail.com
Fri Oct 3 21:50:48 CEST 2008


First off, check your program's indentation.

On Fri, Oct 3, 2008 at 2:04 PM, realNewbie <dilisamom at yahoo.com> wrote:
>
> This is a class assignment, I am to create a program that flips a coin 100
> times and tells me the number of heads and tails.
> I've been working on it for 2 days now and I am stuck. I a trying to run the
> program but it is not running.
> Can someone please point out my error?
>
> Here is what I have come up with:
> import random
> heads=0
> tails=0
> count=1
> while count <101:
>   randomFlip = random.randrange(0,1)
> if randomFlip == 0:
>    heads = heads + 1
> else:
>    tails = tails + 1
> count = count + 1
> print heads," heads"
> print tails," tails"
> --
> View this message in context: http://www.nabble.com/Coin-Flip-tp19802888p19802888.html
> Sent from the Python - tutor mailing list archive at Nabble.com.
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
b h a a l u u at g m a i l dot c o m
Kid on Bus: What are you gonna do today, Napoleon?
Napoleon Dynamite: Whatever I feel like I wanna do. Gosh!


More information about the Tutor mailing list