diff --git a/calculator.py b/calculator.py index 2550c49..5c9ee20 100644 --- a/calculator.py +++ b/calculator.py @@ -5,9 +5,9 @@ # Asks user for 2 operands and 1 operator # Returns output of this operation -a=input("Enter number 1 : ") +a=int(input("Enter number 1 : ")) o=input("Enter operator : ") -b=input("Enter number 2 : ") +b=int(input("Enter number 2 : ")) if o[0] in [ '+','-','*','/' ]: if o[0] == '+': @@ -17,7 +17,11 @@ elif o[0] == '*': out = a * b elif o[0] == '/': - out = a//b + if b==0: + out="Error" + else: + out= a//b + print("Output : ",out) else: print("Error : Invalid Operator")