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
How can you change your mindset ? What are some fears you have had to overcome related to school ?
zavuch27 [327]
You have to change your point of view completely. You have to learn to leave bad habits and replace with new. Some fears include that you will be scared no one will like you or that you won't do good in school.

Hope that helps
5 0
3 years ago
The process of converting software to operate in a second language is called software _______.
kari74 [83]

Answer:

software localization

Explanation:

As international systems penetrate deeper into management and clerical groups, a common language is formed

4 0
1 year ago
What is the best plugin for subscription sites?
Gnom [1K]

Answer:

Explanation:

MemberPress. MemberPress is a popular & well-supported membership plugin. ...

Restrict Content Pro. ...

Paid Memberships Pro. ...

Paid Member Subscriptions. ...

MemberMouse. ...

iThemes Exchange Membership Add-on. ...

Magic Members. ...

s2Member.

6 0
3 years ago
Cual es la importancia de aplicar una riostra como punto de soporte en una estructura
creativ13 [48]

What is the importance of applying a brace as a support point in a structure is given in the following

Explanation:

  • So overall purpose of bracing is to provide additional safety against the external loads in comparable self-building. The main function of the bracing in steel structures that the lateral forces due to wind, earthquake and crane surge etc. are transmitted efficiently to the foundation of the building.
  • In construction, cross bracing is a system utilized to reinforce building structures in which diagonal supports intersect. Cross bracing can increase a building's capability to withstand seismic activity. Bracing is important in earthquake resistant buildings because it helps keep a structure standing.
  • A bracing system is a secondary but essential part of a bridge structure. A bracing system serves to stabilize the main girders during construction, to contribute to the distribution of load effects and to provide restraint to compression flanges or chords where they would otherwise be free to buckle laterally.
  • A bracing system is a secondary but essential part of a bridge structure. A bracing system serves to stabilize the main girders during construction, to contribute to the distribution of load effects and to provide restraint to compression flanges or chords where they would otherwise be free to buckle laterally.
7 0
2 years ago
QUESTION 22 Select the correct statement(s) regarding Carrier Ethernet (CE). a. the Metro Ethernet Forum (MEF) created a CE fram
Molodets [167]

Answer:

d. all are correct statements

Explanation:

CARRIER ETHERNET can be defined as the Ethernet which is a telecommunications network providers that provides and enables all Ethernet services to their customers and as well to help them utilize the Ethernet technology in their networks which is why the word “Carrier” in Carrier Ethernet networks is tend to refers to a large communications services providers that has a very wide reach through all their global networks. Example of the carriers are:

They help to provide audio, video, as well as data services to residential and to all business as well as enterprise customers.

CARRIER ETHERNET also make use of high-bandwidth Ethernet technology for easy Internet access and as well as for communication among the end users.

Therefore all the statement about CARRIER ETHERNET NETWORK are correct

a. Metro Ethernet Forum (MEF) is a type of ethernet which created a Carrier Ethernet framework in order to ensure the interoperability of service provider that the Carrier Ethernet is offerings.

b. The MEF also help to certifies CE network providers, as well as the manufacturers and network professionals in order to ensure interoperability as well as a great service competencies.

c. MEF certified services also include E-Line, E-LAN, E-Tree, E-Access, and E-Transit

Hence, MEF is an important part of Carrier Ethernet because they act as the defining body for them, reason been that they are as well telecommunications service providers, cable MSOs, as well as network equipment and software manufacturers among others.

6 0
3 years ago
Other questions:
  • Additional chemical hazards training must be provided to employees:
    12·1 answer
  • What is the best programming language?
    8·1 answer
  • Which one of the following items is an example of software?
    5·1 answer
  • Me inculparon de crear una cuenta en Facebook y colocaron el barrio donde vivo, ¿cómo podría demostrar lo contrario? Ayuda urgen
    6·1 answer
  • Anyone know this awnser computer science
    14·2 answers
  • Write a method named square that accepts an integer argument and returns the square of that argument.
    10·1 answer
  • What happens if an email server cannot find a matching username or the mailbox is full
    14·2 answers
  • Why should information technology NOT be taught in school?​
    14·1 answer
  • Assignment 3: chabot<br>​
    13·1 answer
  • What is your first step in developing the database?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!