<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">If I remember correctly, int(g) makes the g an integer. So if you typed 9.6 , the int() would make it 9. If you know that the user will only input an integer, you probably won’t even need to use int().<div class=""><br class=""></div><div class="">The things you are asking about it correct.<br class=""><div class=""><br class=""></div><div class="">Jason</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 13, 2015, at 8:37 PM, Michael Havens <<a href="mailto:bmike1@gmail.com" class="">bmike1@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">So here are the snippets I am concerned about:<div class=""><br class=""></div><div class=""><div class="">    g = 0</div><div class="">    guess = int(g)</div><div class="">    g = input("Guess the number: ")<br class=""></div><div class="">    guess = int(g)</div><div class="">  </div></div><div class="">g = 0 is saying 'variable g is zero)</div><div class=""><br class=""></div><div class="">guess = int(g) is saying that the variable guess is equal to variable g and that it is an integer</div><div class=""><br class=""></div><div class="">g = input("<text>") is saying that variable g is now equal to what the use inputs as long as it is a number</div><div class=""><br class=""></div><div class="">the 2nd guess = int(g)is there to put the variable in the while loop</div><div class=""><br class=""></div><div class="">Is that correct?</div></div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="gmail_signature">:-)~MIKE~(-:</div></div>
<br class=""><div class="gmail_quote">On Mon, Apr 13, 2015 at 7:16 PM, Todd Millecam <span dir="ltr" class=""><<a href="mailto:tyggna@gmail.com" target="_blank" class="">tyggna@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">It's a bad variable name is all.  It could be supercalifragilisticexpialidocious = input<br class="">But, it's not really descriptive.  A better name would probably be raw_user_guess = input</div><div class="gmail_extra"><div class=""><div class="h5"><br class=""><div class="gmail_quote">On Mon, Apr 13, 2015 at 7:30 PM, Michael Havens <span dir="ltr" class=""><<a href="mailto:bmike1@gmail.com" target="_blank" class="">bmike1@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">Cool, that is sorta how I wrote it before though they haven't gone over elif yet. As a result of that<i class=""> </i>I deleted '<span style="color:rgb(80,0,80);font-size:12.8000001907349px" class="">g = input("Guess the number: ")' and it kept complaining about the variable not being defined. </span>Question though:<div class="">could we change the 'g' to some other letter...... never mind! I just tried it with 'w' and it works. What does that digit represent?</div></div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="">:-)~MIKE~(-:</div></div><div class=""><div class="">
<br class=""><div class="gmail_quote">On Mon, Apr 13, 2015 at 3:04 PM, Sesso <span dir="ltr" class=""><<a href="mailto:sesso@djsesso.com" target="_blank" class="">sesso@djsesso.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">elif is what you want to use. Here try this. :)<div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">elif = else if</div><div class=""><br class=""></div><div class="">I added the g=0 because the variable needed to be defined.</div><div class="">Same with guess.</div><div class=""><br class=""></div><span class=""><br class=""></span><span class=""><span class="">#!/usr/bin/env python<br class="">print("Welcome.")<br class=""></span>g=0<span class=""><br class="">guess = int(g)<br class="">while guess != 5:<br class="">    g = input("Guess the number: ")<br class="">    guess = int(g)<br class="">    if guess < 5:<br class="">        print("Guess higher.")<br class=""></span>    elif guess > 5:<br class="">        print("Guess lower.")<br class="">    else:<br class="">        print("Correct.”)</span><div class=""><span class=""><br class=""></span></div><div class=""><span class="">jason<br class=""></span><div class=""><div class=""><span class=""><br class=""></span><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Apr 13, 2015, at 1:34 PM, Michael Havens <<a href="mailto:bmike1@gmail.com" target="_blank" class="">bmike1@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Okay Jason, I did it your way. The resulting code being 2 lines shorter. Unfortunately I still have the same problem as before (that being if the guess is wrong it gives no suggestion as to higher/lower but rather just asks you to guess again):<div class=""><br class=""></div><div class=""><div class="">python 1-30guess.py </div><div class="">Welcome.</div><div class="">Guess the number: 0</div><div class="">Guess the number: 0</div><div class="">Guess higher.</div><div class="">Guess the number: 9</div><div class="">Guess lower.</div><div class="">Guess the number: 8</div><div class="">Guess lower.</div><div class="">Guess the number: 7</div><div class="">Guess lower.</div><div class="">Guess the number: 6</div><div class="">Guess lower.</div><div class="">Guess the number: 5</div><div class="">Guess lower.</div><div class="">Correct.</div></div><div class=""><br class=""></div><div class=""> here is the code:</div><div class=""><div class=""><br class=""></div><div class="">#!/usr/bin/env python</div><div class="">print("Welcome.")</div><div class="">g = input("Guess the number: ")</div><div class="">guess = int(g)</div><div class="">while guess != 5:</div><div class="">    g = input("Guess the number: ")</div><div class="">    guess = int(g)</div><div class="">    if guess < 5:</div><div class="">        print("Guess higher.")</div><div class="">    else:</div><div class="">        print("Guess lower.")</div><div class="">print("Correct.")      </div></div></div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="">:-)~MIKE~(-:</div></div>
<br class=""><div class="gmail_quote">On Mon, Apr 13, 2015 at 12:48 PM, Sesso <span dir="ltr" class=""><<a href="mailto:sesso@djsesso.com" target="_blank" class="">sesso@djsesso.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">You may be better off using if statements.<div class=""><br class=""></div><div class=""><br class=""></div><div class="">If number is less than 5</div><div class=""><br class=""></div><div class="">print guess higher</div><div class=""><br class=""></div><div class="">else </div><div class=""><br class=""></div><div class="">print guess lower</div><div class=""><br class=""></div><div class="">Then wrap all of that in a while loop with a condition of while less than 5.</div><div class=""><br class=""></div><div class="">Jason</div><div class=""><div class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Apr 13, 2015, at 12:44 PM, Michael Havens <<a href="mailto:bmike1@gmail.com" target="_blank" class="">bmike1@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">however it does give suggestions on subsequent guesses....</div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="">:-)~MIKE~(-:</div></div>
<br class=""><div class="gmail_quote">On Mon, Apr 13, 2015 at 12:42 PM, Michael Havens <span dir="ltr" class=""><<a href="mailto:bmike1@gmail.com" target="_blank" class="">bmike1@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">here is what I have (that sorta works):<div class=""><br class=""></div><div class=""><span class=""><div class="">print("Welcome.")</div><div class="">g = input("Guess the number: ")</div><div class="">guess = int(g)</div></span><div class="">while guess < 5:</div><span class=""><div class="">    g = input("Guess the number: ")</div><div class="">    guess = int(g)</div></span><div class="">    print("Guess higher.")</div><div class="">while guess > 5:</div><span class=""><div class="">    g = input("Guess the number: ")</div><div class="">    guess = int(g)</div></span><div class="">    print ("Guess lower.")</div><div class="">print("Correct")</div></div><div class=""><br class=""></div><div class=""> What I mean by 'sorta' is if the first guess is not correct  it does not give a suggestion to guess lower or higher. Why is this?</div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="">:-)~MIKE~(-:</div></div><div class=""><div class="">
<br class=""><div class="gmail_quote">On Mon, Apr 13, 2015 at 12:32 PM, Michael Havens <span dir="ltr" class=""><<a href="mailto:bmike1@gmail.com" target="_blank" class="">bmike1@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">that makes sense... thanks!</div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="">:-)~MIKE~(-:</div></div><div class=""><div class="">
<br class=""><div class="gmail_quote">On Mon, Apr 13, 2015 at 12:31 PM, Sesso <span dir="ltr" class=""><<a href="mailto:sesso@djsesso.com" target="_blank" class="">sesso@djsesso.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">The while needs to before input so that it will wait for input if the variable is not equal to 5.</div><div class=""><br class=""></div><div class="">Jason</div><div class=""><div class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On Apr 13, 2015, at 12:21 PM, Michael Havens <<a href="mailto:bmike1@gmail.com" target="_blank" class="">bmike1@gmail.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">nope. that didn't fix it.<br class=""><br class=""></div><div class="gmail_extra"><br clear="all" class=""><div class=""><div class="">:-)~MIKE~(-:</div></div>
<br class=""><div class="gmail_quote">On Mon, Apr 13, 2015 at 11:46 AM, Amit Nepal <span dir="ltr" class=""><<a href="mailto:amit@amitnepal.com" target="_blank" class="">amit@amitnepal.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You would probably want to wait and ask for the input inside the loop as well. What you seem to be doing is you ask for input and then you execute the loop not letting the user input the new number and thus running into an infinite loop.<br class="">
<br class="">
This might fix it, not tested though :)<span class=""><br class="">
<br class="">
print("Welcome.")<br class="">
g = input("Guess the number: ")<br class="">
guess = int(g)<br class="">
<br class="">
while guess != 5<br class="">
    print("Guess again.")<br class=""></span>
    guess = int(g)<br class="">
    print("Correct")<br class="">
<br class="">
<br class="">
Thanks<span class=""><font color="#888888" class=""><br class="">
Amit</font></span><span class=""><br class="">
On 4/13/2015 11:01 AM, Michael Havens wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
print("Welcome.")<br class="">
g = input("Guess the number: ")<br class="">
guess = int(g)<br class="">
while guess != 5:<br class="">
    print("Guess again.")<br class="">
print("Correct")<br class="">
</blockquote>
<br class=""></span><div class=""><div class="">
------------------------------<u class=""></u>---------------------<br class="">
PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank" class="">PLUG-discuss@lists.phxlinux.<u class=""></u>org</a><br class="">
To subscribe, unsubscribe, or to change your mail settings:<br class="">
<a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank" class="">http://lists.phxlinux.org/<u class=""></u>mailman/listinfo/plug-discuss</a><br class="">
</div></div></blockquote></div><br class=""></div>
---------------------------------------------------<br class="">PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank" class="">PLUG-discuss@lists.phxlinux.org</a><br class="">To subscribe, unsubscribe, or to change your mail settings:<br class=""><a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank" class="">http://lists.phxlinux.org/mailman/listinfo/plug-discuss</a></div></blockquote></div><br class=""></div></div></div><br class="">---------------------------------------------------<br class="">
PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank" class="">PLUG-discuss@lists.phxlinux.org</a><br class="">
To subscribe, unsubscribe, or to change your mail settings:<br class="">
<a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank" class="">http://lists.phxlinux.org/mailman/listinfo/plug-discuss</a><br class=""></blockquote></div><br class=""></div></div></div>
</blockquote></div><br class=""></div></div></div></div>
</blockquote></div><br class=""></div>
---------------------------------------------------<br class="">PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank" class="">PLUG-discuss@lists.phxlinux.org</a><br class="">To subscribe, unsubscribe, or to change your mail settings:<br class=""><a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank" class="">http://lists.phxlinux.org/mailman/listinfo/plug-discuss</a></div></blockquote></div><br class=""></div></div></div></div><br class="">---------------------------------------------------<br class="">
PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank" class="">PLUG-discuss@lists.phxlinux.org</a><br class="">
To subscribe, unsubscribe, or to change your mail settings:<br class="">
<a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank" class="">http://lists.phxlinux.org/mailman/listinfo/plug-discuss</a><br class=""></blockquote></div><br class=""></div>
---------------------------------------------------<br class="">PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank" class="">PLUG-discuss@lists.phxlinux.org</a><br class="">To subscribe, unsubscribe, or to change your mail settings:<br class=""><a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank" class="">http://lists.phxlinux.org/mailman/listinfo/plug-discuss</a></div></blockquote></div><br class=""></div></div></div></div></div><br class="">---------------------------------------------------<br class="">
PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank" class="">PLUG-discuss@lists.phxlinux.org</a><br class="">
To subscribe, unsubscribe, or to change your mail settings:<br class="">
<a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank" class="">http://lists.phxlinux.org/mailman/listinfo/plug-discuss</a><br class=""></blockquote></div><br class=""></div></div></div>
<br class="">---------------------------------------------------<br class="">
PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank" class="">PLUG-discuss@lists.phxlinux.org</a><br class="">
To subscribe, unsubscribe, or to change your mail settings:<br class="">
<a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank" class="">http://lists.phxlinux.org/mailman/listinfo/plug-discuss</a><br class=""></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""></div></div><span class="HOEnZb"><font color="#888888" class=""><div class="">Todd Millecam</div>
</font></span></div>
<br class="">---------------------------------------------------<br class="">
PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org" class="">PLUG-discuss@lists.phxlinux.org</a><br class="">
To subscribe, unsubscribe, or to change your mail settings:<br class="">
<a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" target="_blank" class="">http://lists.phxlinux.org/mailman/listinfo/plug-discuss</a><br class=""></blockquote></div><br class=""></div>
---------------------------------------------------<br class="">PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org" class="">PLUG-discuss@lists.phxlinux.org</a><br class="">To subscribe, unsubscribe, or to change your mail settings:<br class=""><a href="http://lists.phxlinux.org/mailman/listinfo/plug-discuss" class="">http://lists.phxlinux.org/mailman/listinfo/plug-discuss</a></div></blockquote></div><br class=""></div></div></body></html>