Skip to content

Commit e25bc47

Browse files
committed
add a function in calculator
1 parent 32ddf0a commit e25bc47

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

calculator.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,25 @@
22
b=int(input("enter second number: "))
33
sank=input("enter what you want to do: ")
44

5+
# here created conditional statement according to input given by user what user want to
6+
def text():
7+
print("Your Answer is here:")
8+
59

610
if(sank=="+") :
11+
text()
712
print(a+b)
813

914
elif(sank=="-"):
15+
text()
1016
print(a-b)
1117
elif(sank=="x"):
18+
text()
1219
print(a*b)
1320
elif(sank=="/"):
21+
text()
1422
print(a/b)
1523
else :
24+
text()
1625
print(a%b)
1726

0 commit comments

Comments
 (0)