[Tutor] new user question about while loops

bob bgailer at alum.rpi.edu
Wed Oct 26 07:58:49 CEST 2005

At 10:53 PM 10/25/2005, Nick Eberle wrote:
>Content-class: urn:content-classes:message
>Content-Type: multipart/alternative;
>         boundary="----_=_NextPart_001_01C5D9F1.A836CF4F"
>Sorry for potential double post, error with first send
>Hello all,
>I had a new question about python. I am pretty much in tutorial learning 
>stages, but attempting to create sample programs not in my book to learn 
>how to construct scripts.
>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.
>My dilemia, how do I get this to work with a while loop? I tried intially 
>then I figured I could just do a while loop and then use the random 
>function each time. At the end it could count the number of times the 
>random generated a 0 or a 1.
>However I can't seem to construct it in a way that makes or works.

Show us your code, as flawed as it might be. Then we can advise you. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20051025/d1304fff/attachment.htm

More information about the Tutor mailing list