【398】COMP9021 - Polynomial
构建 Polynomial 类,实现 +, -, *, / and +=, -=, *=, /=
参考:如何用python编程求解二元一次方程组。如x+y=3;x-y=1
参考:python对重载运算符的限制
参考:python:自定义对象的打印
operator | overwrite |
---|
改写举例:
def __add__(self, other):
...
return Polynomial(self.ex + other.ex)
def __iadd__(self, other):
return Polynomial(self.ex) + Polynomial(other.ex)