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
Stolb23 [73]
3 years ago
6

Write a program that prompts the user to enter an equation in the form of 10 5, or 10-5, or 1*5, or 13/4, or 13%4. The program s

hould then output the equation, followed by an equal sign, and followed by the answer.
Computers and Technology
1 answer:
grandymaker [24]3 years ago
5 0

Answer:

  1. equation = input("Enter an equation: ")
  2. if("+" in equation):
  3.    operands = equation.split("+")
  4.    result = int(operands [0]) + int(operands[1])
  5.    print(operands[0] + "+" + operands[1] + "=" + str(result))
  6. elif("-" in equation):
  7.    operands = equation.split("-")
  8.    result= int(operands [0]) - int(operands[1])
  9.    print(operands[0] + "-" + operands[1] + "=" + str(result))  
  10. elif("*" in equation):
  11.    operands = equation.split("*")
  12.    result = int(operands [0]) * int(operands[1])
  13.    print(operands[0] + "*" + operands[1] + "=" + str(result))  
  14. elif("/" in equation):
  15.    operands = equation.split("/")
  16.    result = int(operands [0]) / int(operands[1])
  17.    print(operands[0] + "/" + operands[1] + "=" + str(result))  
  18. elif("%" in equation):
  19.    operands = equation.split("%")
  20.    result = int(operands [0]) % int(operands[1])
  21.    print(operands[0] + "%" + operands[1] + "=" + str(result))

Explanation:

The solution code is written in Python 3.

Firstly prompt user to enter an equation using input function (Line 1).

Create if-else if statements to check if operator "+", "-", "*", "/" and "%" exist in the input equation. If "+" is found (Line 3), use split method to get the individual operands from the equation by using "+" as separator (Line 5). Output the equation as required by the question using string concatenation method (Line 6).  The similar process is repeated for the rest of else if blocks (Line 7 - 22).  

You might be interested in
A jackhammer uses pressurized gas to transmit force to the hammer bit. What type of mechanical system is it?
Nadya [2.5K]
This is a pneumatic system
7 0
3 years ago
Use the function varimp() on the output of train() and save it to an object called imp:_____.
Orlov [11]

Use the function varimp() on the output of train() and save it to an object called imp object.

<h3>What is the classification that has More than Two Classes and the Caret Package</h3>

In the Classification that has More than Two Classes and the Caret Package section, one need to use the methods that can be able to adapt to higher  forms or dimensions and through a lot of different machine learning algorithms.

Note that varImp is seen as a generic method for calculating variable .

Hence, Use the function varimp() on the output of train() and save it to an object called imp object.

Learn more about Computer function from

brainly.com/question/17048576

#SPJ1

5 0
1 year ago
Important tools used in the _____ phase of the DMAIC process include a project charter, a description of customer requirements,
pishuonlain [190]

Answer:

d. define

Explanation:

DMAIC is an acronym for Define, Measure, Analyze, Improve and Control is a data-driven improvement cycle used for improving processes and driving Six Sigma projects.

Important tools used in the define phase of the Define, Measure, Analyze, Improve, and Control (DMAIC) process include;

- A project charter.

- A description of customer requirements.

- Process maps.

- Voice of the Customer (VOC) data.

5 0
3 years ago
When the "swen" virus infected someone's system, it made significant changes to the registry that caused it to be extremely diff
Effectus [21]
<span>In certain cases, when the Swen executable is removed or renamed by an anti virus program without stopping to fix the registry, it then will become impossible to run any executable files on the machine. This happens because windows will be unable to find the file that is associated with any executables on it's hard drive.</span>
7 0
2 years ago
Which area located at the top of the word screen includes home , insert , and page layout ?
Misha Larkins [42]

Answer:

Whats your qeustion

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • Marie uses a browser to visit a blog. What is the unique identifier of the blog?
    5·1 answer
  • The checksum doesn't compute for a packet sent at the Internet Protocol (IP) level. What will happen to the data?
    14·1 answer
  • An example of hardware is a _____. database spreadsheet monitor program used to enhance photos
    13·2 answers
  • To insert a clip art you must do the following
    14·1 answer
  • Karen thinks she should go out with Blane, an unattractive, social misfit, because “If I don’t go out with him, people will thin
    7·1 answer
  • What is the name of the option in most presentation applications with which you can modify slide elements? The ( answer here )op
    9·1 answer
  • Which view would you need to use to make
    14·1 answer
  • Private BLANK are cloud services available to members of a particular organization.
    6·1 answer
  • How are comments in a Java program treated by the compiler?
    14·2 answers
  • Francisco is becoming a dad for the first time. He feels relatively clueless about all things involving parenting and is looking
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!