forked from JDAWG27/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmath2.py
More file actions
26 lines (21 loc) · 650 Bytes
/
Copy pathmath2.py
File metadata and controls
26 lines (21 loc) · 650 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
26
#Simple Calculator Module
#Define Variables via user input
try:
num1 = int(input("Please enter the first number: "))
except:
print("Please enter a number")
try:
num2 = int(input("Please enter the secound number: "))
except:
print("Please enter a number")
ope = input("Please enter mathematic operand +, -. * or x, /: ")
if(ope == '+'):
print(f"{num1} + {num2} = {num1 + num2}")
elif(ope == '-'):
print(f"{num1} - {num2} = {num1 - num2}")
elif(ope == '*' or ope == 'x'):
print(f"{num1} * {num2} = {num1 * num2}")
elif(ope == '/'):
print(f"{num1} / {num2} = {num1 / num2}")
else:
print("Operator not selected")