```python class Calculator: def add(self, a, b): return a + b def subtract(self, a, b): return a - b def multiply(self, a, b): return a * b def divide(self, a, b): if b == 0: raise ValueError("除数不能为0") return a / b calc = Calculator() print(calc.add(1, 2)) print(calc.subtract(3, 1)) print(calc.multiply(2, 3)) print(calc.divide(6, 2)) ``` [2024-05-25 18:38:05 | AI写代码神器 | 163点数解答]