[Tutor] new user question about while loops

Norman Silverstone norman at littletank.org
Wed Oct 26 09:29:46 CEST 2005

> I understand the format of while loops, but is it possible to use the
> random.randrange function in them?
> My goal, create a program that flips a coin 100 times, at the end it
> says the number of times it flipped heads and flipped tails.

I am also trying to learn python and came across this very exercise. The
answer to your question is yes and, if you like I will post my attempt
at the code. Just for fun, I also got the process to repeat itself 10
times and report the results. It was fun doing it and very encouraging
when it worked.


More information about the Tutor mailing list