Question: Rewrite this program, putting print statements to display the menu and the user input statement inside of a function. The function must return the choice

Rewrite this program, putting print statements to
display the menu and the user input statement inside of a function. The function must return the choice to the calling program. Write and call a second function, sending user choice as an argument. This function performs the selection (IF) statements.
Type in and run this code and describe what happens. Test with all valid and invalid menu choices.
This will be a building block for a future project. (10 Points)
choice =10 #initializes variable to some number
while choice !=0:
print()
print("1. View account balance")
print("2. Make Deposit")
print("3. Withdraw from account")
print("0. Quit ATM program")
print()
choice = int(input("Please enter your choice."))
print()
if choice ==1:
print("Performing task #1")
elif choice ==2:
print("Performing task #2")
elif choice ==3:
print("Performing task #3")
elif choice ==0:
print("Exiting...")
else:
print("Invalid choice")
print()
print("end of program")

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 Programming Questions!