[Tutor] Print/Loop Question

bob gailer bgailer at gmail.com
Thu Mar 17 20:13:58 CET 2011


On 3/17/2011 1:19 PM, Jeff Goodwin wrote:
> I'm trying to run the below program and get it to print out feedback 
> as the loop goes. However, if you enter a number too high or too low, 
> it skips the print statement under the if and elif clauses and asks 
> the user to "Guess a number between 1-100" again. Any suggestions on 
> how to get it to print the "too high" and "too low" responses?? Once 
> the number is entered correctly it prints "Just Right" and exits 
> correctly.
> number = 44
> while guess != number :
>     guess = int(raw_input("Guess a number between 1 - 100: "))
> *if* guess > number :
> *print* ("Too high")
>
> *elif* guess < number :
> *print* ("Too low")
> *else*:
> *print* ("Just right" )

That program is not the one you ran!

Something is missing!

Please also inform us:
Python Version
Operating System
How you run the program.

Be sure to Reply-All so a copy goes to the list.

-- 
Bob Gailer
919-636-4239
Chapel Hill NC

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110317/1bdb2965/attachment.html>


More information about the Tutor mailing list