[Tutor] Python Question - Repeating output.

Guess Who? Me beercanz@hotmail.com
Sun, 09 Jun 2002 02:12:29 +0000


<html><div style='background-color:'><DIV>I downloaded python yesterday and am working through the tutorial. I got to <A href="http://www.honors.montana.edu/~jjc/easytut/easytut/node6.html">http://www.honors.montana.edu/~jjc/easytut/easytut/node6.html</A>, the part about while. I couldn't get it, because if a=0, and a=a+1, then wouldn't 0=1???</DIV>
<DIV>&nbsp;</DIV>
<DIV>And I kept trying to make my own program with while, but they keep giving me infinite answers. Here's what I did:</DIV>
<DIV>&nbsp;</DIV>
<DIV>#I need an idea to make a program using "while". So I'll be lame.</DIV>
<DIV>a=input("Pick a number that is not lame:")<BR>while a==69:<BR>&nbsp;&nbsp;&nbsp; print "Good job!"<BR>while a !=69:<BR>&nbsp;&nbsp;&nbsp; print "Moron."<BR></DIV>
<DIV>It gave me infinite "Moron." or "Good job!"s. </DIV>
<DIV>So basically - any clearer definitions of while? And why does my little program keep giving me infinite loops??</DIV>
<DIV>Thanks.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></div><br clear=all><hr>Chat with friends online, try MSN Messenger: <a href='http://g.msn.com/1HM505401/43'>Click Here</a><br></html>