beginner code problem

Rene Pijlman reply.in.the.newsgroup at my.address.is.invalid
Sat Jun 3 03:03:02 CEST 2006


RJ:
>import random
>flip = random.randrange(2)
>heads = 0
>tails = 0
>count = 0
>while count < 100:
>	if flip == 0:
>		heads += 1
>	else:
>		tails += 1
>	count += 1

Since flip isn't changed in the loop, this is going to report 100 heads or
100 tails, depending on the zeroness of flip.

-- 
René Pijlman



More information about the Python-list mailing list