1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
solmaris [256]
3 years ago
12

Write a calculator program that keeps track of a subtotal like real calculators do. Start by asking the user for an initial numb

er. Inside a loop, asks the user for a mathematical operation and a second number. Do the operation with the first number on the second number. Keep track of the result as a 'subtotal' to be used as the first number when going back to the top of the loop. When the user quits, print out the final result and quit the program. See output for an example for the behavior of the program. The operations should be at least
Computers and Technology
1 answer:
Taya2010 [7]3 years ago
8 0

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

You might be interested in
Universal Containers has a requirement to integrate Salesforce with an external system to control record access.
Alenkasestr [34]

Answer:

C.  Use the SOAP API to maintain the related SObject_share records

Explanation:

In order to ensure that Universal Containers have complete control over the system, the company needs to use certain requirements. This is to ensure that non-authorized persons do not have any access to the information. Based on the information provided in the question, the correct option is option C.

3 0
4 years ago
What is the common name for the growth rate function N?
kolezko [41]

Answer:

Linear.

Explanation:

The common name for the growth rate function N is linear.N growth rate is directly proportional to the input.So it grows linearly.It does not grow rapidly like other growth functions like quadratic,exponential and cubical.

Constant growth does not grow over time it stays as it is.

Hence the answer to this question is linear.

3 0
3 years ago
Describe Atari and explain how the level of technology available at the time impacted the development of Atari game systems
Gelneren [198K]

Answer:

Atari is something that is dangerous .

has led to many bad things to the young ones

4 0
3 years ago
In the circuit shown in the figure above, what will happen when switches S1 and S3 are both closed? 
sp2606 [1]

Well, ya see, we need to have the picture of the circuit.

8 0
3 years ago
A company has determined that its annual profit is typically 51 percent of total sales.
const2013 [10]
Congratulations to the company!

5 0
4 years ago
Other questions:
  • What can be determined from this selection? Check all that apply. The Tax Info worksheet is currently being viewed. There are th
    6·2 answers
  • What the address for dns server that the eorkstation will use?
    10·1 answer
  • What is the amount of a good or service that business have available to sell?
    13·1 answer
  • What does obsolete mean?
    14·2 answers
  • Read the scenario below. Explain why this is not fair use of copyright materials. What should you do instead of using the entire
    10·1 answer
  • An administrator has noticed that GPO containing new update settings has not yet applied to one of the computers on the network.
    5·1 answer
  • What are the differences between tkinter toolkit and PyQt?
    14·1 answer
  • Which is the most popular language used in game programming?
    5·2 answers
  • In the code snippet below, pick which instructions will have pipeline bubbles between them due to hazards.
    12·1 answer
  • What are the things that a computer literate understands?Name thems.​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!