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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started