-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculater.py
34 lines (32 loc) · 916 Bytes
/
calculater.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
class cal():
def __init__(self,a,b):
self.a = a
self.b = b
def add(self):
return self.a+self.b
def sub(self):
return self.a-self.b
def multiply(self):
return self.a*self.b
def multiply(self):
return self.a/self.b
a = int(input('Enter First number :'))
b = int(input('Enter Second number :'))
obj=cal(a,b)
while True:
def menu():
x = ('1.Add \n2.Sub \n3.multiply \n4.divide')
print(x)
menu()
choice = int(input('Please select one of the following: '))
if choice == 1:
print('Result: ',obj.add())
elif choice == 2:
print('Result: ',obj.sub())
elif choice == 3:
print('Result: ',obj.multiply())
elif choice == 4:
print('Result: ',obj.divide())
elif choice == 0:
print("Again try one of than")
break