Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions