-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsimple_cal.py
More file actions
31 lines (30 loc) · 824 Bytes
/
simple_cal.py
File metadata and controls
31 lines (30 loc) · 824 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
27
28
29
30
31
def add(a, b):
add = float(a) + float(b)
return add
def sub(a, b):
sub = float(a) - float(b)
return sub
def mult(a, b):
mult = float(a) * float(b)
return mult
def div(a, b):
div = float(a) / float(b)
return div
while True:
print("========== SIMPLE CALCUALTOR ==========")
a = input("Enter First Number: ")
b = input("Enter Second Number: ")
print("\n1. Add\n2. Substract\n3. Multiply\n4. Divide\n5. Close")
option= int(input('Option 1-5: '))
if option==1:
print("The Result is: ", add(a, b))
elif option==2:
print("The Result is: ", sub(a, b))
elif option==3:
print("The Result is: ", mult(a, b))
elif option==4:
print("The Result is: ", div(a, b))
elif option==5:
break
else:
print('Invalid Input')