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]
4 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]4 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
What kind of device should you install if you need the device to perform network address translation, facilitate access to the I
just olya [345]
The Correct Answer would Be A Router.
8 0
3 years ago
Select the online reading comprehension tool that best fits the description. This tool lets users change text from one language
Dmitrij [34]

Answer:

This tool lets users change text from one language to another.

translation tool

This tool helps users find definitions for difficult vocabulary.

online dictionary

This tool allows users to listen to passages of text that they select.

text-to-speech tool

This tool helps users memorize vocabulary by giving them representations of words using pictures.

flash cards

Explanation:

just did the assignment on edg 2020

7 0
3 years ago
Read 2 more answers
Necesito 7 innovaciones tecnológicas de la informática para 2021
Sonja [21]

‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍  ‍

3 0
3 years ago
In Microsoft Word, when you highlight existing text you want to replace, you are in
ddd [48]
I believe formatting toolbar.
The answer would be B. Basic mode.
6 0
4 years ago
______ is a modem standard that uses Lempel-Ziv encoding to compress data. V.22 V.44 V.32bis V.34 RS 232
tester [92]

Answer:

V44 uses Lempel-Ziv-Welch encoding to compress data.

Explanation:

Lempel–Ziv (LZW) created by Abraham Lempel and Jacob Ziv is a universal lossless data compression algorithm. It is an improvement of LZW algorithm.

It makes use of LZ78 algorithms. This algorithm achieve its compression by taking out repeated occurrences of data with references to a dictionary that is built based on the data stream it received as input.

Also, its dictionary pre-initialized with all available possible characters and symbols.

6 0
3 years ago
Other questions:
  • Each frame is composed of a number of colors recorded in digital format; we call these pixels. What information does the number
    15·1 answer
  • You run anti-virus software on your computer; however, you are experiencing symptoms that may be caused by a virus. What should
    13·1 answer
  • Xbrl taxonomy: is the document format used to produce web pages. is the final product (report. is a classification scheme. is a
    12·1 answer
  • Learning in a digital environment is also called learning.
    6·2 answers
  • How does color affect your mood?
    11·2 answers
  • We all had the unfortunate experience of seeing how computers can, at times, make life's journey about more difficult. This is e
    13·1 answer
  • How would asking questions or defining problems be used in this career?<br> -
    13·1 answer
  • Imagine a typical website that works as a storefront for a business, allowing customers to browse goods online, place orders, re
    13·1 answer
  • An online news website relies on in-page advertisements to make money. Their article pages have multiple slots for advertisement
    5·1 answer
  • 26. Universal Containers (UC) has a queue that is used for managing tasks that need to be worked by the UC customer support team
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!