-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculator.py
More file actions
21 lines (19 loc) · 778 Bytes
/
Calculator.py
File metadata and controls
21 lines (19 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
while(1):
print("###########\nCalculator\n###########")
num=input("1. Add two Number\n2.Substract two Numbers\n3.Multiption two Numbers\n4.Division two Numbers\n 5. Quit\nChoose any one:")
if num == '5':
print("Exitting the calculator.....!!!\n")
exit(0)
if num in ('1','2','3','4'):
a , b=map(float,input("Enter two Numbers with space: ").split())
if num == '1':
print("Result:", a + b)
elif num == '2':
print("Result:", a - b)
elif num == '3':
print('Result:', a * b)
elif num == '4':
if b !=0:
print('Result:', a / b)
else:
print("Error :Divisible by Zero!")