Answer:
num1 = float(input("Enter the first number: "))
while True:
print("Add, Subtract, Multiply, Divide, or Quit ?")
choice = input("Your choice is: ")
if choice == "Quit":
break
num2 = float(input("Enter the second number: "))
if choice == "Add":
num1 += + num2
print("The subtotal is: " + str(num1))
elif choice == "Subtract":
num1 -= num2
print("The subtotal is: " + str(num1))
elif choice == "Multiply":
num1 *= num2
print("The subtotal is: " + str(num1))
elif choice == "Divide":
num1 /= num2
print("The subtotal is: " + str(num1))
print("The final result is: " + str(num1))
Explanation:
Ask the user for the first number
Create a while loop that iterates until specified condition occurs inside the loop
Ask the user for the operation or quitting
If the user chooses quitting, stop the loop. Otherwise, get the second number, perform the operation and print the subtotal
When the loop is done, the user enters Quit, print the final value result