Spaces:
Runtime error
Runtime error
| class CalculatorAgent: | |
| def calculate(self, operation: str, x: str, y: str) -> float: | |
| operation = operation.lower().strip() | |
| x = float(x) | |
| y = float(y) | |
| if operation == "add": | |
| return x + y | |
| elif operation == "subtract": | |
| return x - y | |
| elif operation == "multiply": | |
| return x * y | |
| elif operation == "divide": | |
| if y == 0: | |
| return "Cannot divide by zero" | |
| return x / y | |
| else: | |
| return "Unknown operation" | |