Answered step by step
Verified Expert Solution
Question
1 Approved Answer
So I made a calculator program in Python, and now I need to add a loop until the user uses the menu option to exit
So I made a calculator program in Python, and now I need to add a loop until the user uses the menu option to exit the program and I am not sure how to do that. Below is my previous code.
number_1= int(input("Please enter the first number: ")) number_2= int(input("Please enter the second number:)) operation_variable=input("Please enter the operation you would like to perform:") if operation_variables="+": result_variable=number_1+number_2 print("The sum=", result_variable) elif operation_variable="-": result_variable=number_1-number_2 print("The difference = "result_variable) elif operation_variables="*". result_variable=number_1*number_2 print("The product = ".result_variable) elif operation_variables="/": if number_2 !=0 result_variable=number_1umber_2 print("The quotient=", result_variable) print("You cannot divide by 0")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