Hi Gary, <br>
<br>
In a while loop, you could looping until the while condition is no longer true.<br>
So your one - <br>
<br>
<br>
while password != &quot;unicorn&quot;<br>
<br>
So while password isn't unicorn, your condition is True, so your while
loop will keep looping until the password equals 'unicorn'<br>
<br>
After your 3rd mistake, the if current_count&lt;count condition is no
longer True, so you can't change the password, so the while loop will
go infinite. <br>
<br>
Python goes <br>
<br>
Is password unicorn? Nope.<br>
Is current_count &lt; count? Nope.<br>
better print&nbsp; &quot;That must have been complicated&quot;<br>
Is password unicorn? Nope.<br>

Is current_count &lt; count? Nope.<br>

better print&quot;That must have been complicated&quot;<br>
Is password unicorn? Nope.<br>

Is current_count &lt; count? Nope.<br>

better print &quot;That must have been complicated&quot;<br>
<br>
if you get the drift. <br>
<br>
If you want it to be<br>
<br>
Is password unicorn? Nope.<br>

Is current_count &lt; count? Yup.<br>
Get password....<br>
Is password unicorn? Nope.<br>


Is current_count &lt; count? Yup.<br>

Get password....<br>
Is password unicorn? Nope.<br>


Is current_count &lt; count? Yup.<br>

Get password....<br>
Is password unicorn? Nope.<br>


Is current_count &lt; count? Nope.<br>

Get password....<br>

better print &quot;That must have been complicated&quot;<br>
Now exit the loop<br>
<br>
you need is to check out the break command in a&nbsp; while loop - <br>
<br>
<br>
while 1 == 1:<br>
&nbsp;&nbsp;&nbsp; x = raw_input('Secret? ')<br>
&nbsp;&nbsp;&nbsp; if x == 'foo':<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print 'broke'<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break<br>
&nbsp;&nbsp; else:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print 'loopy, loopy'.<br>
<br>
print 'ended loop'<br>
<br>
<br>
Regards, <br>
<br>
Liam Clarke<br>
<br><br><div><span class="gmail_quote">On Apr 12, 2005 6:54 AM, <b class="gmail_sendername"><a href="mailto:glaevsky@ece.neu.edu">glaevsky@ece.neu.edu</a></b> &lt;<a href="mailto:glaevsky@ece.neu.edu">glaevsky@ece.neu.edu</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hey all,<br><br>Sorry for the bother, thanks for the help.<br><br>I'm trying to write a password guessing program to keep track of<br>how many times the user has entered the password wrong.<br>If it is more than 3 times, print ``That must have been complicated.''<br><br>Following is what I got.&nbsp;&nbsp;If I type &quot;unicorn&quot; it goes straight to &quot;welcome<br>in.&quot; Great.&nbsp;&nbsp;But after my third mistake, it just loops in &quot;That must have<br>been complicated.&quot;<br><br>I'd like for someone to tell me &quot;why&quot; i screwed up.&nbsp;&nbsp;Not to just fix it.<br><br>Thank you so much in advance.&nbsp;&nbsp;And to give you a little smile for a Monday,<br>I've been working on this for days....argh<br><br>#first of all, why does this have to be here?<br>password=&quot;foobar&quot;<br><br>count=3<br>current_count=0<br><br>while password !=&quot;unicorn&quot;:<br>&nbsp;&nbsp;&nbsp;&nbsp; if current_count&lt;count:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; password=raw_input(&quot;Password:&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; current_count=current_count+1<br>&nbsp;&nbsp;&nbsp;&nbsp; else:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print &quot;That must have been complicated&quot;<br><br>print &quot;Welcome in&quot;<br>Best,<br><br>Gary<br><br>Gary Laevsky, Ph.D.<br>Keck Facility Manager, CenSSIS<br>Northeastern University<br>302 Stearns<br>360 Huntington Ave.<br>Boston, MA 02115<br>voice(617) 373 - 2589&lt;br&gt;<br>fax(617) 373 - 7783&lt;br&gt;&lt;br&gt;<br><br><a href="http://www.censsis.neu.edu">http://www.censsis.neu.edu</a><br><br><a href="http://www.ece.neu.edu/groups/osl">http://www.ece.neu.edu/groups/osl</a><br><br><a href="http://www.keck3dfm.neu.edu">http://www.keck3dfm.neu.edu</a><br><br>_______________________________________________<br>Tutor maillist&nbsp;&nbsp;-&nbsp;&nbsp;<a href="mailto:Tutor@python.org">Tutor@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a><br></blockquote></div><br><br><br>-- <br>'There is only one basic human right, and that is to do as you damn well please.<br>And with it comes the only basic human duty, to take the consequences.'