Question: python program using input validation loop Practice input validation loop. Write a function, named menu, to display a menu of three choices and prompt the

 python program using input validation loop Practice input validation loop. Write

python program using input validation loop

Practice input validation loop. Write a function, named menu, to display a menu of three choices and prompt the user to enter 1 or z or 3 for selecting item number 1 or 2 or 3, respectively. If the user's input is Invalid, you should display an error message and then prompt the user to enter again. In other words, there should be an input validation loop in the menu function, for repetitively prompting for a choice until the entered is a valid number which the menu function will return. With the execution of the following main function def main): userChoice menu ) print ) if userChoice1: print ('You chose option 1') elif userChoice2: print ('You chose option 2') else: print ('You chose option 3') an example interactive session is illustrated as below where users' inputs are underlined: Please enter your option (1, 2, or 3) >0 Invalid input, please try again Please enter your option (1, 2, or 3)->4 Invalid input, please try again Please enter your option (1, 2, or 3)->2 You chose option 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!