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
Your network employs basic authentication that centers on usernames and passwords. However, you have two ongoing problems. The f
Agata [3.3K]

Answer:

Using a one time password OTP and using a three factor authentication.

Explanation:

Social engineering is a form system and network attack, drafted by an attacker, to steal user credentials needed for accessing their accounts, to steal information.

Social engineering attacks like phishing, spear phishing, baiting and quid quo pro are used to fool users to giving out their user details.

One time password is an implied use of a password just once and a new password his generated to boost security. In a three factor authentication, OTP can be used as well as biometrics of a user which can not be giving away by a user to an attacker.

8 0
3 years ago
K. What are the types of page orientation?​
Leokris [45]

Answer:

there are 2 landscape and portrait

Explanation:

there are just 2 you can confirm using word and layout

4 0
3 years ago
Java: which expression is evaluated first
nignag [31]

Answer:c ll d  

Explanation:

cus they are inside ()--parantheses

5 0
3 years ago
What are the main types of reading tools? Check all that apply. please HELP​
vovangra [49]

Answer:

Comprehension

reference

3 0
3 years ago
Task queues, which allow for asynchronous performance, are an important part of modern processing architectures. Information abo
Vilka [71]

This subject is a sub-topic in Computer Science and is related to how computers process tasks using Modern Processing Architectures. Modern Processor Architecture is an offshoot of computer architecture.

<h3>What is Modern Processing  Architecture?</h3>

Please note that the information is incomplete hence the general answer. The complete question should provide figures for items 1 to 3.

Modern Processor Architecture is the name given to computer processors with highly advanced capabilities.

In simple language, processors with modern architectures are those that have been built with the ability to complete many instructions or tasks at the same time.

It can also perform or execute these instructions in random order. When a processor is able to do this, it is called Asynchronous performance.

Learn more about Computer Architecture at:

brainly.com/question/18185805

4 0
2 years ago
Other questions:
  • Katie created a web site that automatically scales to fit a cell phone. What kind of design did Katie use?
    12·2 answers
  • Given four values representing counts of quarters, dimes, nickels and pennies, output the total amount as dollars and cents. Out
    10·1 answer
  • A ____________ variable is available throughout a program.
    7·1 answer
  • What is an example of constructive criticism for an employee who is shy during meetings?
    15·2 answers
  • What is a Photojournalist
    5·1 answer
  • Stuart wants to delete some text from a slide. What should Stuart do?A. From the Review tab, choose Highlight text and then pres
    7·2 answers
  • Read first a user's given name followed by the user's age from standard input. Then use an ofstream object named outdata to writ
    6·1 answer
  • In troubleshooting a boot problem, what is the advantage of restoring all BIOS settings to their default values?
    6·1 answer
  • What is the difference between KE an PE
    8·1 answer
  • Describe the major elements and issues with system prototyping​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!