diff --git a/calc.py b/calc.py index de80b21..f8516e2 100755 --- a/calc.py +++ b/calc.py @@ -49,33 +49,33 @@ def div(a, b): b = None op = None -while (True): +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)) else: - print "Invalid operation..." + print("Invalid operation...") - q = raw_input("Quit? [y/n] ") - if (q == "y" or q == "Y"): + q = input("Quit? [y/n] ") + if q == "y" or q == "Y": break # -------------------------------------------------------- #