From da91572a27f182ae1ce66d62f681a59d90d2c17e Mon Sep 17 00:00:00 2001 From: Shivshankargit Date: Thu, 22 Feb 2024 15:23:41 +0530 Subject: [PATCH] Both error solved --- calculator.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/calculator.py b/calculator.py index 2550c49..5f67f8f 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,10 @@ elif o[0] == '*': out = a * b elif o[0] == '/': - out = a//b + if b!=0:: + out="Not allowed" + else: + out = a//b print("Output : ",out) else: print("Error : Invalid Operator")