-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculator.py
More file actions
43 lines (41 loc) · 993 Bytes
/
Calculator.py
File metadata and controls
43 lines (41 loc) · 993 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
32
33
34
35
36
37
38
39
40
41
42
43
#print("Hello Mr. Py Charm\nIam Very Happy to see You Bro \nVery greatful to you")
def fun(a,b):
print(a+b,"\n\n")
calci()
def sub(a,b):
print(a-b,"\n\n")
calci()
def mul(a,b):
print(a*b,"\n\n")
calci()
def div(a,b):
print(a/b,"\n\n")
calci()
def exit():
print("Exit Succesfully")
def calci():
print("Choice-->\n1.sum\n2.subtarction\n3.multilication\n4.div\n5.exit")
z = int(input("Enter Choice-->"))
if z == 5:
exit()
else:
x=int(input("Enter 1st Number:"))
y=int(input("Enter 2nd Number:"))
if z==1:
fun(x,y)
elif z==2:
sub(x,y)
elif z==3:
mul(x,y)
elif z==4:
if y==0:
print("Number Cannot be divided by 0")
calci()
else:
div(x,y)
#elif z==5:
# print("Exit Succesfully")
else:
print("invalid Choice\nTry Again!!!")
calci()
calci()