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
________ is a condition in which information inflow exceeds an individual's processing capacity. Select one: a. Information over
In-s [12.5K]

Answer:

Option a is the correct answer.

Explanation:

  • The information overflow is a state where the coming information will be more in comparison with processing information.
  • For example, if there is limited space and any user has more luggage to keep on that space, then we can say that the luggage is overflow.
  • So when the information is more and the processing capacity is less then we can say it information overflow condition and it is also asked by the above question. Hence option a is the correct answer.
  • While the other is not because:- option b, c and d states some information statements which do not come in any information condition.
6 0
3 years ago
Layer 4 security and application services, including server load balancing, Secure Sockets Layer (SSL) offloading, firewalling,
Fittoniya [83]

Answer:

Layer 4 security and application services, including server load balancing, Secure Sockets Layer (SSL) offloading, firewalling, and intrusion prevention system (IPS) services are provided by the data center <u>aggregation</u> layer.

Explanation:

Consider the given information.

A key point for security and application services is the aggregation layer. In the data centre aggregation layer, the Layer 4 security and application services provide server load balancing, SSL offloading, firewalling, and IPS services.

Layer 4 security and application services, including server load balancing, Secure Sockets Layer (SSL) offloading, firewalling, and intrusion prevention system (IPS) services are provided by the data center <u>aggregation</u> layer.

7 0
3 years ago
The need to upgrade which component would likely lead to replacing the computer?
Alex787 [66]

Answer:

CPU

Explanation:

The CPU is essentially the brain of a CAD system soooo

6 0
3 years ago
What is the best AI app used in education?
goblinko [34]

Answer:

Khan Academy is the best app for education, you can watch videos and do quizes

5 0
3 years ago
Anyone know how to fix this problem on Microsoft Team?
lesya [120]

Answer:

Wait for some time and reload the page

Fix the corrupted file

The file is deleted before finishing upload

Clear browser cache.

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • What is instant messaging
    5·1 answer
  • Here it is crews my profile pic
    5·2 answers
  • How is it possible to find encyclopedias and reference texts on the internet
    11·2 answers
  • (Game Design) The display of all of the properties for an active object is the:
    8·1 answer
  • Write a function named word_count that accepts a string as its parameter and returns the number of words in the string. A word i
    10·1 answer
  • Which group on the home ribbon contains commands to control the alignment of text in a document?
    15·1 answer
  • Select the correct answer.
    12·2 answers
  • Which type of variable has a text value
    6·1 answer
  • Give one advantage of saving file in the same folder<br>​
    13·2 answers
  • WOULD SOMEONE PLEASE ANSWER THIS IVE ASKED TWICE ALREADY!
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!