-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBasicCalculator.py
50 lines (44 loc) · 1.3 KB
/
BasicCalculator.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
def addition(a,b):
answer=a+b
print (f"{a}+{b}={answer}")
def subtraction(a,b):
answer=a-b
print (f"{a}-{b}={answer}")
def multiplication(a,b):
answer=a*b
print (f"{a}X{b}={answer}")
def division(a,b):
answer=a/b
print (f"{a}/{b}={answer}")
while True:
print("A.ADDITION")
print("B.SUBTRACTION")
print("C.MULTIPLICATION")
print("D.DIVISION")
print("E.EXIT")
choice=input("Enter your choice:")
if choice=='a'or choice=='A':
print("ADDITION")
a=int(input("Enter first number:"))
b=int(input("Enter second number:"))
addition(a,b)
elif choice=='b'or choice=='B':
print("SUBTRACTION")
a=int(input("Enter first number:"))
b=int(input("Enter second number:"))
subtraction(a,b)
elif choice=='c'or choice=='C':
print("MULTIPLICATION")
a=int(input("Enter first number:"))
b=int(input("Enter second number:"))
multiplication(a,b)
elif choice=='d'or choice=='D':
print("DIVISION")
a=int(input("Enter first number:"))
b=int(input("Enter second number:"))
division(a,b)
elif choice=='e'or choice=='E':
print("Calcualtor switching off...")
quit()
else:
print("Wrong Choice")