John Carmona wrote:
Thanks for the help Kent, Noel and Alan. Here is my final script (it seems to be working ok but sometimes if I select "quit the programme", I need to enter that option 2 or 3 times before it works, is this a bug

Try this program. Choose option a a few times, then choose f enough times to exit. See if you can figure out what is going on.


def print_options():
       print "------------------------------"
       print "Options:"
       print "a. print options"
       print "f. quit the programme"
       print "------------------------------"
       while 1:
           choice = raw_input("Choose an option: ")
           if choice == 'a':
               print 'About to call print_options'
               print_options()
               print 'Finished calling print_options'
           if choice == 'f': break

print_options()

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to