[Tutor] HANDLING ERRORS
Alan G
alan.gauld at freenet.co.uk
Thu Jun 30 22:25:57 CEST 2005
> numbers = {}
> menu_choice = 0
> print_menu()
> while menu_choice != 5:
>
> try:
>
> menu_choice = input("Type in a number (1-5):")
> if menu_choice == 1:
> print "Telephone Numbers:"
....
>
> except ValueError:
> print "Oops! That was no valid number. Try again..."
The except should align with the 'try' not the 'if'
Does that help?
Otherwise you need to give us a clue as to how it doesn't work.
Do you get an error message? What happens?
Alan G
More information about the Tutor
mailing list