Re: python code

Forside
Vedhæftede filer:
Indlæg som e-mail
+ (text/plain)
Slet denne besked
Besvar denne besked
Skribent: Amit Nepal
Dato:  
Til: plug-discuss
Emne: Re: python code
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 -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss