PY
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
"""program for simple calculation... e.g- 3+5=8
1.input 1st number
2.input 2nd number
3.enter the operator(+,*,-,/)"""
#-------------------------------
def calc(a,b):
add,sub,mul,div=a+b,a-b,a*b,a/b
if x== "+":
print(a,"+",b,"=",add)
elif x=="-":
print(a,"-",b,"=",sub)
elif x=="*":
print (a,"*",b,"=",mul)
elif x=="/":
print(a,"/",b,"=",div)
else:
return ("INVALID OPERARTION")
#--------------------------------
print ("********MY CALCULATOR*********")
a=int(input("Enter 1st number:"))
print (a)
b=int(input ("Enter 2nd number:"))
print (b)
x=(input("Enter the operator(+,*,+,/):"))
print (x)
calc(a,b)
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run