def calculate(a, b, operation): if operation == "+": return a + b if operation == "-": return a - b if operation == "*": return a * b if operation == "/": if b == 0: raise ValueError("Division by zero is not allowed") return a / b raise ValueError(f"Unsupported operation: {operation}") def main(): print("Simple Python Calculator") first = float(input("Enter the first number: ")) operation = input("Choose operation (+, -, *, /): ").strip() second = float(input("Enter the second number: ")) try: result = calculate(first, second, operation) print(f"Result: {result}") except ValueError as error: print(f"Error: {error}") if __name__ == "__main__": main()