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
4. What is the connection between productivity and Microsoft Office/ Office 365?
ikadub [295]
Microsoft 365 plans for home and personal include the robust Office desktop apps that you're familiar with, like Word, PowerPoint, and Excel. ... Office 2019 is sold as a one-time purchase, which means you pay a single, up-front cost to get Office apps for one computer.

Hope this helps :)
3 0
2 years ago
The set of instructions that tell the computer what to do are called ____.
CaHeK987 [17]
Hi,

The word you are looking for is "programs".

Hope this helps.
r3t40
4 0
3 years ago
Read 2 more answers
What portable computing devices, designed for user convenience, have a sensor called an accelerometer that senses vibrations and
Tomtit [17]

The answer is Tablets. It is a portable personal computer, generally with a mobile operating system and LCD touchscreen display processing circuitry, and a rechargeable battery in a single thin, flat package. It is bigger than smartphones.

7 0
2 years ago
To locate all locations in a document with the word "employer" and replace it with "company," you should use the _____ function.
grandymaker [24]
That should be the replace function which performs word replacements in documents.
6 0
3 years ago
Which access method would be most appropriate if your manager gave you a special cable and told you to use it to configure the s
GrogVix [38]
Console Port Method

Connecting a computer to a Cisco device through the console port requires a special console cable.
8 0
2 years ago
Other questions:
  • If a security officer is non-commissioned officer, he can carry a baton on duty if he went through a training class
    8·1 answer
  • Gina's teacher has sent her a Word document that contains the names of all the students who are participating in the
    11·2 answers
  • What is the best operating system
    12·1 answer
  • Text can be easily moved from one location to another using _____.
    15·1 answer
  • Anthony is responsible for tuning his organization's intrusion detection system. He notices that the system reports an intrusion
    8·1 answer
  • We will use linear interpolation in a C program to estimate the population of NJ between the years of the census, which takes pl
    10·1 answer
  • Cloud computing is an old phenomenon in computing infrastructure dating back to the early days of the Internet that involves mov
    10·1 answer
  • Can someone find out what this binary number thing is. Just find out the message, I'm having a difficult time
    13·1 answer
  • What is the value of the variable named result after the following code executes?
    10·1 answer
  • You should move around and take a rest for 30 minutes every 5 minutes.<br><br>True Or False​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!