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
A digital footprint is .
BlackZzzverrR [31]

Your digital footprint is the trail of 'electronic breadcrumbs' you leave behind when you use the internet. It can include the websites you visit, the photos you upload and your interactions with other people on social networks.

3 0
3 years ago
Jacek has just started a new job as a sales clerk, and his first task is to create a new sales invoice. Which Microsoft software
g100num [7]

Answer:

Microsoft Excel

Explanation:

Microsoft Excel is a Microsoft application package. It is a spreadsheet application used to analyse and manipulate data. It has columns which are referred to fields and rows also known as records.There are various features in excel that used to create statistical and graphical esctasies and data presentations.

It can be used to create template for CVs/resumes, Bank draft, receipts and invoice etc.

5 0
3 years ago
Where are some places that cyberbullying occurs? check all that apply
antiseptic1488 [7]

Answer:

social media like  snap chat twitter  and face book .it can even happen over email.or in school chats.

Explanation:

5 0
3 years ago
Read 2 more answers
What type of compensation does a travel agent receive from suppliers?
insens350 [35]

The travel agents receive compensation from suppliers such as waiting time compensation, night ride compensation, and cancellation compensation.

<u>Explanation</u>:

  • The travel agents from ola, uber and other companies usually receive compensation such as 10 percent commission of booking fees.  Usually, if the customer cancels the ride the travel agent will receive compensation for that ride.  They also receive time compensation for their work.
  • For long rides, the travel agents will receive extra compensation for that. Because the distance for that ride will be long. So they will receive these types of compensations from suppliers.    

6 0
3 years ago
Read 2 more answers
Value appears on the left hand side of cell <br> true or false
11111nata11111 [884]

Answer:

True

Your welcome

.........

4 0
2 years ago
Read 2 more answers
Other questions:
  • 11. Describe an algorithm that interchanges the values of the variables x and y, using only assignments. What is the minimum num
    10·1 answer
  • The World Wide Web consists of interconnected computer networks throughout the world that everyone can use. True or False
    13·2 answers
  • Very large and very small numbers are easier to write in scientific notation. For example, the number, 0.000000728 would be writ
    7·1 answer
  • . Database connectivity software is also known as:
    11·1 answer
  • A user contacted the help desk to report that the laser printer in his department is wrinkling the paper when printed. The user
    5·1 answer
  • Deb needs to add borders on the cells and around the table she has inserted into her Word document.
    7·1 answer
  • If you wanted to divide an integer variable by 2, which of the following lines of code would you use? total = int + 2 total = in
    6·1 answer
  • Someone please help ASAP will brainlist
    9·2 answers
  • If you wish to install a new OS without disturbing the old one so that you can boot to either OS, what type of boot setup should
    6·1 answer
  • There is overlap in the subjects of study in the different information technology disciplines. true or false
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!