Faulty calculator program using python

 Faulty calculator program using python

This calculator returns faulty values for  45*3=555, 56+9=77 and 56/6=4



print("THIS IS OUR CALCULATOR")
print("enter operator for calculation [+,_,/,*] :")
opr=input()
print("value 1 :")
inp1=int(input())
print("value 2 :")
inp2=int(input())
mylist=["+","-","*","/"]
if inp1==45 and inp2==3 and opr=="*":
print("calculation of 45 + 3 is 555")
elif inp1==56 and inp2==9 and opr=="+":
print("calculation of 56 + 9 is 77")
elif inp1==56 and inp2==6 and opr=="/":
print("calculation of 56 / 6 is 4")
elif opr in mylist[0]:
print(" calculation of ",inp1, opr, inp2 ,"is ",inp1+inp2)
elif opr in mylist[1]:
print(" calculation of ",inp1, opr, inp2 ,"is ",inp1-inp2)
elif opr in mylist[2]:
print(" calculation of ",inp1, opr, inp2 ,"is ",inp1*inp2)
elif opr in mylist[3]:
print(" calculation of ",inp1, opr, inp2 ,"is ",inp1/inp2)
else:
print("something went wrong")

Comments