From d78a2c5a193b8beb693c55105d88801dfeac80f1 Mon Sep 17 00:00:00 2001 From: MickeyShahzad Date: Thu, 13 Feb 2025 12:43:23 -0600 Subject: [PATCH] =?UTF-8?q?Mickey=F0=9F=8D=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calc.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/calc.py b/calc.py index de80b21..6dcc576 100755 --- a/calc.py +++ b/calc.py @@ -51,30 +51,34 @@ def div(a, b): while (True): # get input values - a = raw_input("Enter the first argument: ") - op = raw_input("Enter the operation: ") - b = raw_input("Enter the second argument: ") + a = input("Enter the first argument: ") + op = input("Enter the operation: ") + b = input("Enter the second argument: ") try: a = int(a) b = int(b) except ValueError: - print "Invalid number argument..." + print("Invalid number argument...") op = None # decide function if (op != None): if (op == "+"): - print "Sum: ", add(a, b) + print("Sum: ", add(a, b)) elif (op == "-"): - print "Difference: ", sub(a, b) + print("Difference: ", sub(a, b)) elif (op == "*"): - print "Product: ", mult(a, b) + print("Product: ", mult(a, b)) elif (op == "/"): - print "Quotient: ", div(a, b) + print("Quotient: ", div(a, b)) + elif (op == "^"): + print("Power: ", pow(a, b)) + elif (op == "%"): + print("Modulus: ", a%b) else: - print "Invalid operation..." + print("Invalid operation...") - q = raw_input("Quit? [y/n] ") + q = input("Quit? [y/n] ") if (q == "y" or q == "Y"): break