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
Artyom0805 [142]
3 years ago
8

Write a python code for a calculator

Computers and Technology
2 answers:
Bingel [31]3 years ago
8 0

Answer:

In this example you will learn to create a simple calculator that can add, subtract, multiply or divide depending upon the input from the user.

Explanation:

SIZIF [17.4K]3 years ago
4 0
I am sure you are using an editor but if doesn’t work you can search online python compiler .

Answer :

We know that a calculater should be able to calculate ( addition , subs traction, multiplication, division …etc)

# first takng inputs
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))

# operations
print("Operation: +, -, *, /")
select = input("Select operations: ")

# check operations and display result
# add(+) two numbers
if select == "+":
print(num1, "+", num2, "=", num1+num2)

# subtract(-) two numbers
elif select == "-":
print(num1, "-", num2, "=", num1-num2)

# multiplies(*) two numbers
elif select == "*":
print(num1, "*", num2, "=", num1*num2)

# divides(/) two numbers
elif select == "/":
print(num1, "/", num2, "=", num1/num2)

else:
print("Invalid input")
You might be interested in
BRAINLIEST!!!!!!!!!!!!!!
Contact [7]

Answer:

Open

Explanation:

Trust

6 0
2 years ago
Read 2 more answers
By default, after how much time has elapsed in a client's DHCP lease will the client attempt to renew the lease?
maw [93]
The client will attempt to renew halfway through the time of the lease.
3 0
3 years ago
A formula =A1+B2 is in cell D8. If you copy that formula to cell D9, what is the new formula in cell D9? A. '=A1+B2 B. '=A2+B3 C
Georgia [21]
It has to be B. Im sure of it.
6 0
4 years ago
Read 2 more answers
I need answers and explanation
larisa86 [58]

Answer:

B. Run-time Error

Explanation:

You can't divide by zero in math because it could be divided by itself an infinite number of time, which is not possible.

A. Syntax error is just the 'grammar' of the code. An example could be forgetting to add a semicolon at the end of your code in C. Another example is forgetting to close brackets or quotes

<em>printf("inclomplete string      </em>WRONG, will give syntax error

B. Run-time error is an error that occurs while the program is running. This might happen because of many reasons, one of which is calculation errors such as dividing by 0.

C. I don't know what an Undetected Error is. Never hear of it.

D. Logic error is an error when a condition is not logically correct. This could be because you used the wrong type of operator.

if(a = b)   WRONG, will give logic error

if(a == b)    CORRECT

4 0
3 years ago
Applying patches is much easier today because of the advent of:
Nadusha1986 [10]

Answer:

A. The internet.

Explanation:

Patches can be defined as software updates released by developers to add new features, upgrade software, install new drivers and fix notable functionality issues (software bugs) associated with an installed software application. These software patches are usually made available on the software developer's website and other third-party platforms for download by the end users.

Hence, through the availability of a network connection (internet), patches are uploaded to the cloud or file server by the software manufacturer or developer for continuous and easy access (download) to all interested users. Thus, applying patches is much easier today because of the advent of the internet.

6 0
3 years ago
Other questions:
  • Which of the following would an interactive media proffessional must likely need
    9·1 answer
  • What is the part of the computer system that receives inputs, directs those inputs to the processor, and redirects the processed
    14·1 answer
  • __________ was the first operating system to integrate security as its core functions.
    15·2 answers
  • The performance of a client-server system is strongly influenced by two major network characteristics: the bandwidth of the netw
    6·1 answer
  • How can our perceptions help us to choose the channel for our message?
    5·1 answer
  • Lucy wants to develop a web page to display her profile. She wants to just start with a basic page that lists her accomplishment
    13·1 answer
  • To date, what has most propelled the digital revolution?
    10·1 answer
  • And<br>Why the computer is called dilligent<br>Versatile machine?give long answer ​
    10·1 answer
  • WAp to input the radius and print<br> the area of circle
    15·1 answer
  • a. Describe how the student can use the jar of rice to model particle motion of a substance in each state of matter: solid, liqu
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!