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
During which part of geologic time were dinosaurs most common?
ANTONII [103]
The answer is C. Jurassic.
6 0
3 years ago
Read 2 more answers
Why is musical notation important? What benefits do musicians and others receive from being able to write down and note aspects
madreJ [45]
Most importantly, musicians can share their works with others.  Other people can see their musical ideas and can try and perform them too.   Nuances such as tempo, dynamics (loud soft, sweet, "harsh", are just some examples) can be understood even if the composer is not present and there is no recording to listen to.
Financial benefits can be realized from the sale of sheet music, scoring the piece, arranging the piece for bands, orchestras, etc. Conductors can lead an entire musical ensemble through the piece. 
4 0
3 years ago
How is AI used in racing ?
NikAS [45]
This now allows human pilots to race together with AI drivers. The AI driver is, in this case, the intelligent software that gathers all data from the sensors and other touchpoints to drive the car.
3 0
3 years ago
Frames control what displays on the Stage, while keyframes help to set up
pogonyaev

Answer: A keyframe is a location on a timeline which marks the beginning or end of a transition. So for example, you have a movie and it transitions to another scene, keyframes tell it when and where to start the transition then when and where to stop the transition.

3 0
3 years ago
If there has been no change in the data regarding a specific person, place or thing, information about that person, place or thi
babymother [125]
I think it’s b false sorry if I was wrong
6 0
3 years ago
Other questions:
  • Which type of software-generated problems can indicate that a software bug is causing a memory error?
    11·1 answer
  • what is the restaurant with the black pom tree and yellow backround three letter name from hi guess the restaurant
    14·2 answers
  • When should you use the Reply All function when replying to an email
    10·2 answers
  • While working on a group project, you notice something does not look right in the presentation. You call a meeting with your tea
    14·2 answers
  • You’ve been stuck in bumper-to-bumper traffic for nearly an hour on a hot summer day. The temperature warning light has just com
    7·1 answer
  • Add a new row to a table by clicking in the
    10·1 answer
  • Peripeteia is also referred to as __________.
    5·2 answers
  • How do I type over Images (photo posted ​
    12·2 answers
  • Select the correct answer.
    8·2 answers
  • you are packing a mobile phone containing a lithium ion battery and you get a prompt on the screen to put a lithium ion label on
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!