forked from Azure-Samples/python-docs-hello-world
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
25 lines (22 loc) · 661 Bytes
/
app.py
File metadata and controls
25 lines (22 loc) · 661 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Python program to make a simple calculator
# take inputs
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
# choose operation
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)
# multiply (*) two numbers
elif select == "*":
print(num1, "*", num2, "=", num1*num2)
# divide (/) two numbers
elif select == "/":
print(num1, "/", num2, "=", num1/num2)
else:
print("Invalid input")