Answer to Question #41431 in Python for matt
For try/except, there are two places in which you will receive user input. The first is in a function that displays a menu and obtains a selection from the user. The function must return the selection as an integer. Therefore, it must refuse input from the user until an integer has been typed in. The second place an integer is required is the guess. Do not accept a guess from the user unless an integer is typed at the keyboard. That is, ask him/her to try again if they enter something other than an integer. You'll need to use a while loop to operate the menu driven interface. There are three choices: •0: exit •1: guess •2. get a new secret number
No comments. Be first!