This topic is READ ONLY
Hobo1 (1) [Avatar] Offline
#1
The program in Listing 8.8 only executes correctly the first time. If you enter anything but 3 the first time it will end the program. If you enter 3 at the first prompt, you can enter anything you want at the subsequent prompts and it will continue the loop until you interrupt. A more appropriate program would be:

someInput = int(input("Type 3 to continue, anything else to quit."))
while someInput == 3:
(indent)print ("Thank you for the 3. Very kind of you.")
(indent)someInput = int(input("Type 3 to continue, anything else to quit."))
(indent)if someInput != 3:
(indent)(indent)print ("That's not a 3, so I'm quitting now.")
carter.sande (32) [Avatar] Offline
#2
Re: A better program for Listing 8.8
Would you mind e-mailing us your code at cp4khelp@yahoo.com? Listing 8.8 works perfectly fine for us. There may be a slight typo in your code that stops it from working properly.

Carter