<p>If  the guess is larger than the number, your code will never prompt for a new guess in the while loop.  Try removing one indent on the input() line.</p>
<p><blockquote type="cite">On Sep 24, 2011 10:44 AM, &quot;Cameron Macleod&quot; &lt;<a href="mailto:cmacleod170@gmail.com">cmacleod170@gmail.com</a>&gt; wrote:<br><br>Hi,<br><br>I&#39;ve been trying to code a simple guess my number game as a 
starter programming project but I&#39;ve generated an infinite loop 
accidentally. Since I&#39;m new to programming in general, I can&#39;t really 
figure out what&#39;s causing it. Thanks<br>
<br>=======================<br><br>import random<br><br>print(&quot;\tWelcome to &#39;Guess my Number&#39;!&quot;)<br>print(&quot;\nI&#39;m thinking of a number between 1 and 100.&quot;)<br>print(&quot;Try to guess it in as few attempts as possible.\n&quot;)<br>


<br>#set the initial values<br>the_number = random.randint(1, 100)<br>guess = int(input(&quot;Take a guess: &quot;))<br>tries = 1<br><br># guessing loop<br>while guess != the_number:<br>    if guess &gt; the_number:<br>        print(&quot;Lower...&quot;)<br>


    else:<br>        print(&quot;Higher...&quot;)<br><br>        guess = int(input(&quot;Take a guess: &quot;))<br>        tries += 1<br><br>print(&quot;You guessed it! The number was&quot;, the_number)<br>print(&quot;And it only took you&quot;, tries, &quot;tries!\n&quot;)<br>


<br>if tries &lt;= 5:<br>    print(&quot;I didn&#39;t know roadrunners could type!&quot;)<br>elif tries &gt;= 99:<br>    print(&quot;P&#39;raps &#39;Only&#39; wasn&#39;t the right word...&quot;)<br>elif tries == 100:<br>

    print(&quot;0_0 You are the unluckiest person in the world. Or the stupidest...&quot;)<br>
<br>input(&quot;\n\nPress the enter key to exit.&quot;)<br><br><div style="padding:0px;margin-left:0px;margin-top:0px;overflow:hidden;word-wrap:break-word;color:black;font-size:10px;text-align:left;line-height:130%">
</div>
<br>_______________________________________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
To unsubscribe or change subscription options:<br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
<br></blockquote></p>