[Tutor] AAAACCCKKK LOOPS :(

Arie van Willigen rellik19@yahoo.com
Sat, 10 Aug 2002 10:25:30 -0700 (PDT)


--0-1893635468-1029000330=:48232
Content-Type: text/plain; charset=us-ascii


Hi Im having difficulty figuring out how to create a certain loop i wanted to know how whould I have a random number generator continue to spit outnumbers until it gets a one or a two. This is my current code:

import random
mynum = random.randrange(1,13)
print mynum
if mynum < 3:
    print "*Click*"
else:
    print "Your Attempt Failed"

thank you 

 

 


Me Myself And I... Oh Yeah Arie Too...


---------------------------------
Do You Yahoo!?
HotJobs, a Yahoo! service - Search Thousands of New Jobs
--0-1893635468-1029000330=:48232
Content-Type: text/html; charset=us-ascii

<P>Hi Im having difficulty figuring out how to create a certain loop i wanted to know how whould I have a random number generator continue to spit outnumbers until it gets a one or a two. This is my current code:</P>
<P>import random<BR>mynum = random.randrange(1,13)<BR>print mynum<BR>if mynum &lt; 3:<BR>&nbsp;&nbsp;&nbsp; print "*Click*"<BR>else:<BR>&nbsp;&nbsp;&nbsp; print "Your Attempt Failed"</P>
<P>thank you </P>
<P>&nbsp;</P>
<P>&nbsp;</P><BR><BR>Me Myself And I... Oh Yeah Arie Too...<p><br><hr size=1><b>Do You Yahoo!?</b><br>
<a href="http://rd.yahoo.com/careers/mailsig/new/*http://www.hotjobs.com">HotJobs, a Yahoo! service</a> - Search Thousands of New Jobs
--0-1893635468-1029000330=:48232--