python code

Sesso sesso at djsesso.com
Mon Apr 13 12:31:13 MST 2015


The while needs to before input so that it will wait for input if the variable is not equal to 5.

Jason


> On Apr 13, 2015, at 12:21 PM, Michael Havens <bmike1 at gmail.com> wrote:
> 
> nope. that didn't fix it.
> 
> 
> :-)~MIKE~(-:
> 
> On Mon, Apr 13, 2015 at 11:46 AM, Amit Nepal <amit at amitnepal.com <mailto:amit at amitnepal.com>> wrote:
> 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.
> 
> This might fix it, not tested though :)
> 
> print("Welcome.")
> g = input("Guess the number: ")
> guess = int(g)
> 
> while guess != 5
>     print("Guess again.")
>     guess = int(g)
>     print("Correct")
> 
> 
> Thanks
> Amit
> On 4/13/2015 11:01 AM, Michael Havens wrote:
> print("Welcome.")
> g = input("Guess the number: ")
> guess = int(g)
> while guess != 5:
>     print("Guess again.")
> print("Correct")
> 
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org <mailto:PLUG-discuss at lists.phxlinux.org>
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss <http://lists.phxlinux.org/mailman/listinfo/plug-discuss>
> 
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20150413/09cd372d/attachment.html>


More information about the PLUG-discuss mailing list