Question: My python code should have a function for printing welcome info and a menu, a function to get the user input and return a valid
My python code should have a function for printing welcome info and a menu, a function to get the user input and return a valid choice, and have a main function that calls the functions in the appropriate order and outputs valid choice. My code below, seems to be off.
def main():
def welcomemenu(): print('Welcome to the area computation tool') print('******MENU******') print('tri Compute area of a triangle') print('trap Compute area of a tapezoid') print('quit Quit the tool') welcomemenu() userinput = input('Please enter your choice: ') while True: if (userinput == 'tri'): print('You chose: tri') elif (userinput == 'trap'): print('You chose: trap') elif (userinput == 'quit'): exit(0) else (userinput + 'is an invalid choice')
main()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
